home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 007 / wasm.arc / WASM.DOC < prev   
Encoding:
Text File  |  1986-02-19  |  101.0 KB  |  3,722 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.                               \\\ WASM ///
  17.  
  18.                                Version 1.0
  19.  
  20.             Wolfware Assembler for the IBM Personal Computer
  21.  
  22.  
  23.  
  24.                     (C) Copyright 1985 by Eric Tauck
  25.  
  26.                               Wolfware (tm)
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.                       A Short Description of WASM
  62.  
  63.           - WASM is an assembler.  It takes a standard DOS
  64.             ASCII text file of 8088 instruction mnemonics for
  65.             input and produces an executable COM file and an
  66.             optional list file for output.
  67.  
  68.           - Features: supports full range of 8088 instructions
  69.             and most standard "pseudo operations" to fully
  70.             control assembly, signed and unsigned numbers,
  71.             operand expressions, produces executable code
  72.             (does not require linking), BASIC subroutines,
  73.             fast operation, and efficient use of memory.
  74.  
  75.           - Minimum system requirements: IBM PC or compatible,
  76.             DOS 1.0 and up, and 64K memory.
  77.  
  78.           - This version of WASM does NOT support macros,
  79.             external linking, or multisegment definitions.
  80.  
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.                                 Foreword
  122.  
  123.           High level languages like BASIC and Pascal can make
  124.           the creation of a working program a simple and
  125.           straightforward process.  There is a price to this
  126.           convenience though, control and freedom.  High level
  127.           languages rarely take full advantage of a particular
  128.           machine's potential.  The only way to tap the full
  129.           resources of a computer is to program in assembly
  130.           language.
  131.  
  132.           Assembly language programming has immediate and
  133.           practical benefits:
  134.  
  135.           - Programs can be made to run hundreds, maybe
  136.             thousands of times faster than their high level
  137.             language counterparts.
  138.  
  139.           - Programs can take full advantage of the
  140.             capabilities of the machine it was meant to run
  141.             on.
  142.  
  143.           - The actual code needed to run the program is
  144.             usually much less then the code resulting from
  145.             programs written in high level languages.
  146.  
  147.           If one is willing to sacrifice the ease of use and
  148.           portability of high level languages, the results of
  149.           assembly language programming can be quite
  150.           rewarding.
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.                         WASM Distribution Policy
  182.  
  183.           Unmodified copies of this program and documentation
  184.           may be freely shared and distributed.  Under no
  185.           circumstances may this program be sold for profit
  186.           without the express consent of the author.
  187.  
  188.           Use this program at your own risk.  The author
  189.           assumes no responsibility for damages real or
  190.           imaginary resulting from this work.
  191.  
  192.           Send all questions, comments, and complaints to:
  193.  
  194.  
  195.                          Eric Tauck
  196.                          Wolfware
  197.                          1304 Deerpass Rd.
  198.                          Marengo, IL 60152
  199.  
  200.  
  201.           Compuserve: 72457,1557
  202.  
  203.  
  204.  
  205.  
  206.  
  207.  
  208.  
  209.  
  210.  
  211.  
  212.  
  213.  
  214.  
  215.  
  216.  
  217.  
  218.  
  219.  
  220.  
  221.  
  222.  
  223.  
  224.  
  225.  
  226.  
  227.  
  228.  
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.  
  241.                            Table of Contents
  242.  
  243.           Introduction .................................. 1
  244.           Running WASM .................................. 2
  245.           Assembly Listing .............................. 4
  246.           Basic Syntax .................................. 8
  247.           Operands ..................................... 10
  248.           Special Operands ............................. 18
  249.           Combining Operands ........................... 21
  250.           Pseudo-Op Descriptions ....................... 22
  251.           WASM Instruction Set ......................... 29
  252.           Source Code Clarification .................... 39
  253.           Errors ....................................... 43
  254.           Programming .................................. 51
  255.           Reserved Symbols ............................. 56
  256.           Technical Notes .............................. 57
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.  
  270.  
  271.  
  272.  
  273.  
  274.  
  275.  
  276.  
  277.  
  278.  
  279.  
  280.  
  281.  
  282.  
  283.  
  284.  
  285.  
  286.  
  287.  
  288.  
  289.  
  290.  
  291.  
  292.  
  293.  
  294.  
  295.  
  296.  
  297.  
  298.  
  299.  
  300.  
  301.           Introduction                                       1
  302.  
  303.           WASM is designed for quick and easy assembly
  304.           programming.  It is best used for writing smaller or
  305.           ad hoc programs, system patches, utilities, etc.
  306.  
  307.           WASM is comparable to other assemblers in terms of
  308.           what it will and won't do.  Some things that are NOT
  309.           supported in this version of WASM are macros,
  310.           external linking, and multisegment definitions.
  311.           These three things are mostly time savers, and
  312.           useful though they can be, there is little that can
  313.           be done with them that can't be without them.
  314.  
  315.           The code produced by WASM is a memory image, COM
  316.           file format.  It is ready for execution and does not
  317.           require processing by the linker.
  318.  
  319.           If you do not know anything or very little about
  320.           assembly language programming on the 8088, you will
  321.           probably need to acquire a book on the subject.  Try
  322.           to get one that does not stress a particular
  323.           assembler, but one about programming on the 8088
  324.           microprocessor in general.
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.  
  335.  
  336.  
  337.  
  338.  
  339.  
  340.  
  341.  
  342.  
  343.  
  344.  
  345.  
  346.  
  347.  
  348.  
  349.  
  350.  
  351.  
  352.  
  353.  
  354.  
  355.  
  356.  
  357.  
  358.  
  359.  
  360.  
  361.           Running WASM                                       2
  362.  
  363.           Once you have a program to assemble, from DOS type
  364.           WASM.  WASM will display a short message and then
  365.           prompt you for the name of the source file, object
  366.           file, and list file.
  367.  
  368.           - If no extension is given for the source file, an
  369.             extension of ASM will be added.
  370.  
  371.           - If you just press enter for the name of the object
  372.             file, WASM will default to the name and drive of
  373.             your source file with an extension of COM.
  374.  
  375.           - If you just press enter for the list file, WASM
  376.             will not generate a list output (this will speed
  377.             up assembly).  If a name without an extension is
  378.             entered, WASM will add an extension of LST.  If no
  379.             drive is specified, the object file drive will be
  380.             used.  Instead of entering the name of a file in
  381.             which to save the listing, you may enter a device
  382.             name.  Entering CON will send the list output to
  383.             the screen and entering PRN will send it to the
  384.             printer (see the section in the DOS manual on
  385.             reserved device names).
  386.  
  387.           The names of the files can be entered as parameters
  388.           when WASM is initially executed.  The first parameter
  389.           is the source name, the second is the object name,
  390.           and the third is the list name.  The same rules for
  391.           the names apply.  If a parameter is left out then
  392.           the default name will be used (though names can only
  393.           be left off the end, for instance you can't give the
  394.           list file name without the object and source
  395.           file names).
  396.  
  397.           Examples:
  398.  
  399.           WASM TEST
  400.             Will read from the source file TEST.ASM on the
  401.             default drive, write the object file TEST.COM on
  402.             the default drive, and not generate a listing.
  403.  
  404.           WASM A:TEST B:
  405.             Will read from the source file TEST.ASM on drive
  406.             A, write the object file TEST.COM to drive B, and
  407.             not generate a listing.
  408.  
  409.           WASM A:TEST B: TEST
  410.             Will read from the source file TEST.ASM on drive
  411.             A, write the object file TEST.COM to drive B, and
  412.             write the list file TEST.LST to drive B.
  413.  
  414.           WASM A:TEST B: A:TEST
  415.             Will read from the source file TEST.ASM on drive
  416.             A, write the object file TEST.COM to drive B, and
  417.             write the list file TEST.LST to drive A.
  418.  
  419.  
  420.  
  421.           Running WASM                                       3
  422.  
  423.           WASM A:TEST B: CON
  424.             Will read from the source file TEST.ASM on drive
  425.             A, write the object file TEST.COM to drive B, and
  426.             display the listing on the screen.
  427.  
  428.           WASM B:CLP .BLD
  429.             Will read from the source file CLP.ASM on drive B,
  430.             write the object file CLP.BLD to drive B, and not
  431.             generate a listing.  BLD makes a good extension
  432.             for BLOADable files.
  433.  
  434.           WASM A:TEST.TXT  A:.BIN  PRN
  435.             Will read from the source file TEST.TXT on drive
  436.             A, write the object file TEST.BIN to drive A, and
  437.             send the listing to the printer.  Note: WASM does
  438.             not check to see if the printer is ready, so make
  439.             sure the printer is properly set up before sending
  440.             any list output there.
  441.  
  442.           Path names for DOS 2.0 and up are not recognized.
  443.           All files must be in the current directory.
  444.  
  445.           Any errors detected in the source code will be
  446.           displayed to the screen if a listing is not being
  447.           generated.
  448.  
  449.           Assembly, depending on the size of the source file,
  450.           should take anywhere from several seconds to several
  451.           minutes (about 30 lines/second if the files are on
  452.           floppy disk drives).  When assembly is complete
  453.           control is returned to DOS.  The resulting object
  454.           code is ready to be executed.
  455.  
  456.  
  457.  
  458.  
  459.  
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466.  
  467.  
  468.  
  469.  
  470.  
  471.  
  472.  
  473.  
  474.  
  475.  
  476.  
  477.  
  478.  
  479.  
  480.  
  481.           Assembly Listing: Description                      4
  482.  
  483.           Initially and at the beginning of each page of list
  484.           output WASM displays various assembly information.
  485.           In the upper right corner is the WASM version and
  486.           page number, just below is the assembly time and
  487.           date, and finally below that is the name of the
  488.           source file.  In the upper left corner is the
  489.           program title, and right below is the subtitle.  The
  490.           title and subtitle are optional and may be set by
  491.           the user with the TITLE and SUBTITLE pseudo-ops.
  492.           Following all this is a header for the listing.  The
  493.           header labels represent the following: LOC stands
  494.           for location counter, OBJ stands for object code,
  495.           LINE is the line number, and SOURCE is the source
  496.           code.  The actual listing is then displayed, lined
  497.           up below the appropriate labels.
  498.  
  499.           The source line is truncated if necessary to make
  500.           the length of the entire list line equal to the
  501.           width setting (the default setting is 79).  The
  502.           width may be modified by the LINESIZE pseudo-op.
  503.  
  504.           Lines with no code, lines with only a comment, and
  505.           certain pseudo-ops do not display the location
  506.           counter.  The EQU statement displays its value
  507.           indented from the start of the location counter
  508.           column.  EQU statements that name memory locations
  509.           put brackets around their value.
  510.  
  511.           Line which do not generate any object code do not
  512.           (cannot) display any object code.  The DS pseudo-op
  513.           never displays its object code.  PROC statements
  514.           display the present PROC nest level in the object
  515.           code column.
  516.  
  517.           Included source code (through the use of the INCLUDE
  518.           pseudo-op) does its own line numbering based on the
  519.           line number within the included file.  When an
  520.           included file ends, the line numbering picks up
  521.           where it had left off.  All included source code has
  522.           a dash immediately following the line number.  The
  523.           INCLUDE line itself is always output whether or not
  524.           a listing is being generated.  This output allows
  525.           the determination of which included file contained
  526.           an error, useful when there are several included
  527.           files and a listing is not being generated.
  528.  
  529.           If paging has been activated through the PAGE+
  530.           pseudo-op, a new page is started after every 60 list
  531.           lines.  Every new page after the first begins with a
  532.           form feed (ASCII 12).  The number of lines per page
  533.           may be modified through the use of the PAGESIZE
  534.           pseudo-op.
  535.  
  536.           At the end of assembly WASM displays the number of
  537.           errors detected (including diagnostics), the total
  538.           number of source lines processed, the number of
  539.           bytes of code.
  540.  
  541.           Assembly Listing: Description                      5
  542.  
  543.           Finally, if a listing is being generated, the symbol
  544.           table will be displayed in alphabetical order.  The
  545.           first ten characters and the hex value of each
  546.           symbol is shown.  Undefined symbols are included in
  547.           the table with a value of ????.  Underscores are
  548.           ignored for purposes of alphabetization, i.e.
  549.           something like "A_A" would be considered equal to
  550.           "AA".
  551.  
  552.  
  553.  
  554.  
  555.  
  556.  
  557.  
  558.  
  559.  
  560.  
  561.  
  562.  
  563.  
  564.  
  565.  
  566.  
  567.  
  568.  
  569.  
  570.  
  571.  
  572.  
  573.  
  574.  
  575.  
  576.  
  577.  
  578.  
  579.  
  580.  
  581.  
  582.  
  583.  
  584.  
  585.  
  586.  
  587.  
  588.  
  589.  
  590.  
  591.  
  592.  
  593.  
  594.  
  595.  
  596.  
  597.  
  598.  
  599.  
  600.  
  601.           Assembly Listing: Example                          6
  602.  
  603.  
  604.  
  605.    List Example                                      WASM/1.0 -- Page 1
  606.    Size Checker                                Feb 14, 1986 at 04:26:22
  607.                                                  Source file: CHECK.ASM
  608.  
  609.    LOC  OBJ           LINE   SOURCE                  WOLFWARE ASSEMBLER
  610.  
  611.                          1   ;-------------------------------------;
  612.                          2   ;              List Example           ;
  613.                          3   ;Compare available memory to 500 and  ;
  614.                          4   ;print response. This is a program to ;
  615.                          5   ;show an example of the assembly      ;
  616.                          6   ;listing.                             ;
  617.                          7   ;-------------------------------------;
  618.                          8
  619.                          9      LINESIZE   68
  620.                         10      TITLE   'List Example','Size Checker'
  621.                         11
  622.    0100 -> 1            12      PROC    FAR
  623.                         13
  624.       01F4              14   PRO_BYTE EQU   500            ;needed
  625.      [0006]             15   SEG_BYTE EQU   WORD [0006H]   ;available
  626.                         16
  627.                         17   ;----- check memory
  628.                         18
  629.    0100 813E0600F401    19      CMP     SEG_BYTE,PRO_BYTE  ;check bytes
  630.    0106 7208            20      JB      SIZERR             ;jump if err
  631.                         21
  632.                         22   ;----- memory OK
  633.                         23
  634.    0108 BA1B01          24      MOV     DX,OFFSET MESS_OK  ;OK mess
  635.    010B E80A00          25      CALL    DISPLAY            ;display
  636.    010E CD20            26      INT     20H                ;exit to DOS
  637.                         27
  638.                         28   ;----- memory error
  639.                         29
  640.    0110                 30   SIZERR
  641.    - - - Error: Undefined symbol: MESS_ER
  642.    0110 BA0000          31      MOV     DX,OFFSET MESS_ER  ;error mess
  643.    0113 E80200          32      CALL    DISPLAY            ;display
  644.    0116 CD20            33      INT     20H                ;exit to DOS
  645.                         34
  646.  
  647.  
  648.  
  649.  
  650.  
  651.  
  652.  
  653.  
  654.  
  655.  
  656.  
  657.  
  658.  
  659.  
  660.  
  661.           Assembly Listing: Example                          7
  662.  
  663.  
  664.  
  665.    List Example                                      WASM/1.0 -- Page 2
  666.    Data                                        Feb 14, 1986 at 04:26:23
  667.                                                  Source file: CHECK.ASM
  668.  
  669.    LOC  OBJ           LINE   SOURCE                  WOLFWARE ASSEMBLER
  670.  
  671.                         35      PAGE    'Data'
  672.                         36
  673.                         37   ;----- external message display routine
  674.                         38
  675.    0118                 39      INCLUDE 'DISPLAY'          ;incl file
  676.    0118 -> 2             1 - DISPLAY    PROC  NEAR
  677.    - - - Error: Syntax error: MOB
  678.    0118                  2 -    MOB     AH,9    ;print str
  679.    0118 CD21             3 -    INT     21H     ;DOS function
  680.    011A C3               4 -    RET
  681.    011B -> 2             5 -    ENDP
  682.                         40
  683.                         41   ;----- response messages
  684.                         42
  685.    011B 546865726520    43   MESS_OK  DB      'There is enough memory$'
  686.         697320656E6F
  687.         756768206D65
  688.         6D6F727924
  689.    0132 4E656564206D    44   MESS_ERR DB      'Need more memory$'
  690.         6F7265206D65
  691.         6D6F727924
  692.                         45
  693.    0143 -> 1            46      ENDP
  694.  
  695.        2 Error(s) detected
  696.       51 Line(s) processed
  697.       67 Byte(s) of code
  698.        7 Symbol(s)
  699.  
  700.    SYMBOL TABLE DUMP:
  701.  
  702.    DISPLAY    0118    MESS_ER    ????    MESS_ERR   0132
  703.    MESS_OK    011B    PRO_BYTE   01F4    SEG_BYTE   0006
  704.    SIZERR     0110
  705.  
  706.  
  707.  
  708.  
  709.  
  710.  
  711.  
  712.  
  713.  
  714.  
  715.  
  716.  
  717.  
  718.  
  719.  
  720.  
  721.           Basic Syntax                                       8
  722.  
  723.           WASM accepts a standard DOS text file for input as
  724.           source code.  Lines may be up to 255 characters
  725.           long.  Upper and lower-case are not distinguished.
  726.           All letters except those in strings are converted to
  727.           upper-case.
  728.  
  729.           Spaces and all control characters are always treated
  730.           as delimiters.  Commas, +, -, *, -, [, ], are also
  731.           treated as delimiters but have special meaning.
  732.           Single quotes are used to delimit strings and semi-
  733.           colons indicate comments.  All other characters are
  734.           assumed to be part of the fields representing the
  735.           labels, instructions, and operands.
  736.  
  737.           An end of file marker (ASCII 26) is assumed to mark
  738.           the end of the source file, even if there is more
  739.           text in the file.  If no end of file marker is
  740.           found, WASM reads the number of bytes specified in
  741.           the directory.
  742.  
  743.           Every line of source code is divided up into fields.
  744.           The fields are always separated from each other by
  745.           one or more delimiters.  WASM determines the purpose
  746.           of a field by the position it occupies in the source
  747.           line.  Each source line uses the following format:
  748.  
  749.           Label        Instruction   Operand(s)     ;Comment
  750.  
  751.  
  752.           Labels
  753.             Labels may or may not be required, depending upon
  754.             the instruction.  Labels may stand alone (i.e. be
  755.             the only thing in the line).  Anything beginning
  756.             in the first column is considered a label.  A
  757.             label may be separated by any number of spaces
  758.             from the instruction.  Labels may be any size and
  759.             consist of any characters.  All labels must be
  760.             unique from each other and other operand types.
  761.             It is recommended that labels begin with a letter
  762.             A to Z and consist of only letters, numbers, and
  763.             underscores.  See also the Reserved Symbols
  764.             section.
  765.  
  766.           Instructions
  767.             Instructions are the next field after labels.  If
  768.             a source line does not contain a label then the
  769.             first field is the instruction.  An instruction
  770.             can begin in any column but the first.  At least
  771.             one space must separate a label from an
  772.             instruction on the same line.  There can never be
  773.             any operands without an instruction.  The
  774.             available instructions are described in the WASM
  775.             Instruction Set and the Pseudo-Op Descriptions
  776.             sections.
  777.  
  778.  
  779.  
  780.  
  781.           Basic Syntax                                       9
  782.  
  783.           Operands
  784.             All the fields after the instruction are defined
  785.             as operands.  The actual number of operands
  786.             required is determined by the instruction.  WASM
  787.             ignores extra operands after the required ones.
  788.             There should be at least one space between an
  789.             instruction and its operands.  Commas and spaces
  790.             are usually used to separate operands from each
  791.             other.  Commas act as "hard delimiters" by forcing
  792.             the final evaluation of an operand.  Without a
  793.             comma WASM will evaluate the first expression
  794.             (field) and then search for a plus, minus, or
  795.             similar operator to use to combine the next
  796.             expression with the first.  The valid operand
  797.             types are described in the Operands section.
  798.  
  799.           Comments
  800.             Comments only serve to explain the source code and
  801.             are always optional.  Comments must appear at the
  802.             end of the source line.  Lines may contain only a
  803.             comment.  Comments never have any effect on the
  804.             assembly itself.  All source code on a single line
  805.             following a semicolon is considered a comment and
  806.             is disregarded.  Note that semicolons are treated
  807.             as comment indicators even within strings, and can
  808.             only be represented as data by their numerical
  809.             value.
  810.  
  811.  
  812.  
  813.  
  814.  
  815.  
  816.  
  817.  
  818.  
  819.  
  820.  
  821.  
  822.  
  823.  
  824.  
  825.  
  826.  
  827.  
  828.  
  829.  
  830.  
  831.  
  832.  
  833.  
  834.  
  835.  
  836.  
  837.  
  838.  
  839.  
  840.  
  841.           Operands: General                                 10
  842.  
  843.           Operands can be described according to three
  844.           different qualities: type, size, and value.  The
  845.           type describes where the bits that are being acted
  846.           upon are coming from and where they are going
  847.           (registers, immediate data, etc.); the size
  848.           describes how many bits are being acted upon (8
  849.           bits, 16 bits, etc.); and the value describes which
  850.           bits are one and which are zero (43, -8, 10, etc.).
  851.  
  852.           The following subsections formally describes
  853.           operands in terms of these three qualities.  In
  854.           practice, the knowledge of the 8088 architecture
  855.           makes much of this information is intuitive.
  856.  
  857.           Basically the type and size of the operands must
  858.           match those of the instruction.  For each version of
  859.           each instruction the allowable types and sizes of
  860.           the operands are given in the WASM Instruction Set
  861.           section.
  862.  
  863.  
  864.  
  865.  
  866.  
  867.  
  868.  
  869.  
  870.  
  871.  
  872.  
  873.  
  874.  
  875.  
  876.  
  877.  
  878.  
  879.  
  880.  
  881.  
  882.  
  883.  
  884.  
  885.  
  886.  
  887.  
  888.  
  889.  
  890.  
  891.  
  892.  
  893.  
  894.  
  895.  
  896.  
  897.  
  898.  
  899.  
  900.  
  901.           Operands: Types                                   11
  902.  
  903.           WASM figures out the type of an operand by looking
  904.           at it and trying to match it to one of the formats
  905.           it recognizes.  The following is a summary of the
  906.           legal operand types and their formats:
  907.  
  908.           I. Immediate data operands.
  909.  
  910.              A. Numbers with an optional plus or minus
  911.                 preceding it.  All numbers must begin with a 0
  912.                 to 9, and anything that begins as such is
  913.                 considered a number.  Numbers with a sign must
  914.                 be in the range -32768 to +32767, otherwise
  915.                 they must be 0 to 65535
  916.  
  917.                 1. A binary number of up to 16 digits of ones
  918.                    and zeros followed by a "B".
  919.  
  920.                 2. A decimal number from 0 to 65535.
  921.  
  922.                 3. A hexadecimal number of up to 4 digits of 0
  923.                    to F followed by an "H".  Hexadecimal
  924.                    numbers that begin with A to F should have
  925.                    a preceding 0.
  926.  
  927.              B. A single character enclosed in single quotes
  928.                 (except a semicolon, see part V).  The
  929.                 character is converted to an ASCII value, so
  930.                 'z' would be the same as the number 122.
  931.  
  932.              C. A single question mark may be used to indicate
  933.                 that the value is not known or not important.
  934.                 WASM interprets a question mark as zero.
  935.  
  936.           II. Register operands.
  937.  
  938.               A. One of the following 8 bit registers:
  939.  
  940.                    AH  AL  BH  BL  CH  CL  DH  DL
  941.  
  942.               B. One of the following 16 bit registers:
  943.  
  944.                    AX  BX  CX  DX  SP  BP  SI  DI
  945.  
  946.               C. One of the following segment registers:
  947.  
  948.                          CS  SS  DS  ES
  949.  
  950.           III. Memory operands.
  951.  
  952.                A. Direct addressing.
  953.  
  954.                   1. A label that identifies a memory location
  955.                      or data (memory label).
  956.  
  957.  
  958.  
  959.  
  960.  
  961.           Operands: Types                                   12
  962.  
  963.                   2. A value enclosed by brackets.  All
  964.                      numbers (immediate data) inside the
  965.                      brackets are added or subtracted together
  966.                      to form the value.
  967.  
  968.                B. Indirect addressing through the use of one
  969.                   of the following register combinations with
  970.                   an optional value added or subtracted in:
  971.  
  972.                              BX  BP  DI  SI
  973.  
  974.                        BX+DI  BX+SI  BP+DI  BP+SI
  975.  
  976.                   The entire combination is surrounded by
  977.                   brackets.  The registers can appear in any
  978.                   order and may be mixed up with any numbers.
  979.                   All numbers (immediate data) are added or
  980.                   subtracted together to form the value.  The
  981.                   OFFSET special operand may be used, though
  982.                   it can be assumed for any labels.
  983.  
  984.           IV. A label that marks some location in the program.
  985.               Can be a near (within same segment) or far
  986.               (possibly in another segment).  Far labels only
  987.               exist as theory in this version of WASM.  Near
  988.               and far labels always mark a location in the
  989.               code (not data).  Labels are assumed to be near
  990.               unless otherwise defined, including labels that
  991.               are alone on a line.
  992.  
  993.           V. A string of any sequence of characters surrounded
  994.              by single quotes.  Note: semicolons and single
  995.              quotes cannot be represented as a character in a
  996.              string or as an immediate data character.  These
  997.              two characters can only be represented as
  998.              numerical values.
  999.  
  1000.           Operand types may be explicitly set by using the
  1001.           NEAR, FAR, and OFFSET special operands (see the
  1002.           Special Operands section).
  1003.  
  1004.           The following are examples of all the major operand
  1005.           types.
  1006.  
  1007.  
  1008.  
  1009.  
  1010.  
  1011.  
  1012.  
  1013.  
  1014.  
  1015.  
  1016.  
  1017.  
  1018.  
  1019.  
  1020.  
  1021.           Operands: Types                                   13
  1022.  
  1023.           Immediate data:
  1024.  
  1025.             MOV    AL,'W' ;move the ASCII value
  1026.                           ;of upper-case w to AL
  1027.  
  1028.           ;the following lines all assemble to "move zero to AX"
  1029.             MOV    AX,0
  1030.             MOV    AX,-21 + 21
  1031.             MOV    AX,-21 - -21
  1032.             MOV    AX,50000 * 0
  1033.             MOV    AX,-6 / -3 - 2
  1034.             MOV    AX,NOT 1111111111111111B
  1035.             MOV    AX,0FFH-128-64-32-16-8-4-2-1
  1036.  
  1037.           ;remember that numbers MUST start with 0 to 9, even
  1038.           ;hexadecimal numbers
  1039.            MOV    AX,0FFFFH  ;move ffff hex to AX
  1040.  
  1041.  
  1042.           Registers:
  1043.  
  1044.           ;8 bit examples
  1045.              MOV     AL,DL
  1046.              MOV     CL,0
  1047.  
  1048.           ;16 bit examples
  1049.              MOV     AX,DX
  1050.              MOV     CX,0
  1051.  
  1052.           ;segment examples
  1053.              MOV     DX,SS
  1054.              MOV     CX,0
  1055.              MOV     ES,CX  ;cannot move immed. directly to seg
  1056.  
  1057.  
  1058.           Memory operands:
  1059.  
  1060.           ;direct reference examples
  1061.              MOV     [100],AX
  1062.              PUSH    DATA
  1063.              MOV     DATA,0
  1064.  
  1065.           ;the next three produce the same effect
  1066.              MOV     CX,[DATA]           ;OFFSET implied
  1067.              MOV     CX,[OFFSET DATA]
  1068.              MOV     CX,DATA             ;this is best
  1069.  
  1070.           ;indirect reference examples
  1071.              MOV     [BX],AX
  1072.              MOV     DX,[BX+SI+100]
  1073.              INC     BYTE [OFFSET DATA+DI-1001011B+BP-3]
  1074.  
  1075.           DATA    DW      ?
  1076.  
  1077.  
  1078.  
  1079.  
  1080.  
  1081.           Operands: Types                                   14
  1082.  
  1083.           Near labels:
  1084.  
  1085.           LABEL1
  1086.           LABLE2  LABEL   NEAR
  1087.           LABEL3  NOP
  1088.           ;all three of these jump to the NOP instruction
  1089.              JMPS    LABEL1
  1090.              JMPS    LABEL2
  1091.              JMPS    LABEL3
  1092.  
  1093.  
  1094.           Strings:
  1095.  
  1096.              DB      'this is a string'
  1097.           ;this represents the string "semicolon ; semicolon"
  1098.              DB      'semicolon ',59,' semicolon'
  1099.  
  1100.  
  1101.  
  1102.  
  1103.  
  1104.  
  1105.  
  1106.  
  1107.  
  1108.  
  1109.  
  1110.  
  1111.  
  1112.  
  1113.  
  1114.  
  1115.  
  1116.  
  1117.  
  1118.  
  1119.  
  1120.  
  1121.  
  1122.  
  1123.  
  1124.  
  1125.  
  1126.  
  1127.  
  1128.  
  1129.  
  1130.  
  1131.  
  1132.  
  1133.  
  1134.  
  1135.  
  1136.  
  1137.  
  1138.  
  1139.  
  1140.  
  1141.           Operands: Sizes                                   15
  1142.  
  1143.           If the value of one operand is directly acting upon
  1144.           the value of another operand (like adding or moving
  1145.           one to the other), the sizes of the operands must
  1146.           always agree.  The size that is common between two
  1147.           operands must be an allowable size for the
  1148.           particular version of the instruction.  Most
  1149.           operands are either 8 bits (byte) or 16 bits (word).
  1150.  
  1151.           The size of registers are always implicit.
  1152.           Registers come in 8 and 16 bit sizes.
  1153.  
  1154.           The size of memory operands are either implicit by
  1155.           the other operand, or must be explicitly set by the
  1156.           user.  If the other (non-memory) operand is a
  1157.           register, the memory operand is assumed to be the
  1158.           same size as the register.  If the other operand is
  1159.           immediate data, the size of the memory operand must
  1160.           always be defined by the user (this is because the
  1161.           size of immediate data may be ambiguous).
  1162.  
  1163.           The size of immediate data depends on its value and
  1164.           whether or not the operand is signed.  Signed
  1165.           numbers in the range -128 to 127 are either 8 or 16
  1166.           bit sizes.  Signed numbers in the range -32768 to
  1167.           32767 (but not -128 to 127) are only 16 bit size.
  1168.           Unsigned numbers are either 8 or 16 bit sizes if
  1169.           they are in the range 0 to 255, and just 16 bit size
  1170.           if they are 0 to 65535 (but not 0 to 255).  These
  1171.           sizes are according to the actual number of bits it
  1172.           takes to represent the data.
  1173.  
  1174.           Operand sizes may be defined by the user through the
  1175.           BYTE, WORD, DWORD, QWORD, TBYTE and ANYSIZE special
  1176.           operands (see the Special Operands section).  The
  1177.           DB, DW, and LABEL pseudo-ops automatically define
  1178.           the size of their labels for use as memory operands.
  1179.  
  1180.           Examples:
  1181.  
  1182.  
  1183.           Operands acting upon each other, sizes must agree:
  1184.  
  1185.                   MOV     AX,BX   ;AX is 16 bit, BX is 16 bit
  1186.                   ADD     DX,0    ;DX is 16 bit, 0 can be 8 or
  1187.                                   ;16 bit
  1188.  
  1189.                   MOV     AL,128   ;AL is 8 bit, 128 is
  1190.                                    ;unsigned 8 or 16 bit
  1191.                   MOV     AL,+128  ;error!, AL is 8 bit, +128 is
  1192.                                    ;signed 16 bit
  1193.  
  1194.  
  1195.  
  1196.  
  1197.  
  1198.  
  1199.  
  1200.  
  1201.           Operands: Sizes                                   16
  1202.  
  1203.           Operands not acting upon each other, sizes do not
  1204.           have to agree:
  1205.  
  1206.                   IN      AL,DX   ;AL is 8 bit
  1207.                                   ;DX is 16 bit
  1208.  
  1209.  
  1210.           Memory operand assumed to be size of register:
  1211.  
  1212.                   SUB     BL,[BX+SI+10]   ;8 bit subtract
  1213.                   MUL     AX,DATA         ;16 bit multiply
  1214.  
  1215.           DATA    DW      10
  1216.  
  1217.  
  1218.           Memory operand size must be defined by user:
  1219.  
  1220.           STORAGE DW      0               ;STORAGE is 16 bit
  1221.  
  1222.           NUMBER  EQU     100H
  1223.                   ADD     WORD [SI],NUMBER    ;16 bit addition
  1224.                   SUB     STORAGE,1  ;16 bit subtraction,
  1225.                                      ;storage has been defined
  1226.                                      ;above in declaration
  1227.                   MOV     DATA, 254    ;8 bit move, DATA
  1228.                                        ;is defined below
  1229.  
  1230.           DATA    LABEL   BYTE            ;DATA is 8 bit
  1231.  
  1232.  
  1233.  
  1234.  
  1235.  
  1236.  
  1237.  
  1238.  
  1239.  
  1240.  
  1241.  
  1242.  
  1243.  
  1244.  
  1245.  
  1246.  
  1247.  
  1248.  
  1249.  
  1250.  
  1251.  
  1252.  
  1253.  
  1254.  
  1255.  
  1256.  
  1257.  
  1258.  
  1259.  
  1260.  
  1261.           Operands: Values                                  17
  1262.  
  1263.           All operands have a value, but unless the operand is
  1264.           some kind of immediate data the value is transparent
  1265.           to the user.  Immediate data is stored as a 16 bit
  1266.           value.  Signed numbers are stored in two's
  1267.           complement format.
  1268.  
  1269.           Operand values may be modified by using the NOT
  1270.           special operand (see the Special Operands section).
  1271.  
  1272.  
  1273.  
  1274.  
  1275.  
  1276.  
  1277.  
  1278.  
  1279.  
  1280.  
  1281.  
  1282.  
  1283.  
  1284.  
  1285.  
  1286.  
  1287.  
  1288.  
  1289.  
  1290.  
  1291.  
  1292.  
  1293.  
  1294.  
  1295.  
  1296.  
  1297.  
  1298.  
  1299.  
  1300.  
  1301.  
  1302.  
  1303.  
  1304.  
  1305.  
  1306.  
  1307.  
  1308.  
  1309.  
  1310.  
  1311.  
  1312.  
  1313.  
  1314.  
  1315.  
  1316.  
  1317.  
  1318.  
  1319.  
  1320.  
  1321.           Special Operands                                  18
  1322.  
  1323.           Special operands act as function by taking a normal
  1324.           operand as an argument and returning, with possible
  1325.           modification, the type, size, and/or value of its
  1326.           argument.  Special operands and an argument can
  1327.           usually be used in place of any normal operand. The
  1328.           format is:
  1329.  
  1330.                         Special_Operand  Argument
  1331.  
  1332.           At least one delimiter must separate the two.  The
  1333.           argument for a special operand may not be extended.
  1334.           Special operands can never be signed, but their
  1335.           arguments can.  Special operands should not be
  1336.           nested.  The following are descriptions of all the
  1337.           special operands:
  1338.  
  1339.  
  1340.           NOT
  1341.             Returns the logical not (flip all bits) of its
  1342.             argument.  Type and size are not changed.  Accepts
  1343.             only immediate data as its argument.
  1344.  
  1345.             ;these two statements produce the same code
  1346.                   MOV     AL,NOT 1
  1347.                   MOV     AL,FEH
  1348.  
  1349.  
  1350.           OFFSET
  1351.             Returns the offset of a label and makes the type
  1352.             immediate data and the size 16 bit.  Accepts near,
  1353.             far, and memory labels as arguments.  Used mainly
  1354.             to load the address of program data.
  1355.  
  1356.             ;put message location in SI
  1357.                   MOV     SI, OFFSET MESSAGE
  1358.             ;put message length in CX
  1359.                   MOV     CX, OFFSET END - OFFSET MESSAGE
  1360.  
  1361.             MESSAGE   LABEL  BYTE
  1362.                   DB   'This is the message'
  1363.             END       LABEL  BYTE
  1364.  
  1365.  
  1366.           PROGRAM_SIZE
  1367.             This is not a normal special operand, in the sense
  1368.             that it does not have an argument.  It returns the
  1369.             size of the program in bytes as a 16 bit immediate
  1370.             data operand.  The information returned is exactly
  1371.             like the information returned by specifying the
  1372.             OFFSET of a label which has been declared at the
  1373.             end of the program minus 100H.  Used mainly in
  1374.             defining a BLOAD program header.
  1375.  
  1376.               MOV  AX,PROGRAM_SIZE   ;size of program into AX
  1377.  
  1378.  
  1379.  
  1380.  
  1381.           Special Operands                                  19
  1382.  
  1383.           NEAR
  1384.             Returns the value and size of its argument but
  1385.             changes the type to a near label.  Accepts near
  1386.             labels, far labels, memory labels, and immediate
  1387.             data as arguments.  Used mainly for the PROC
  1388.             pseudo-op.
  1389.  
  1390.             SUBROUTINE    PROC    NEAR
  1391.                   NOP
  1392.                   ENDP
  1393.  
  1394.             ;can be used for jumps to a literal address
  1395.                   JMP   NEAR 100  ;jump to beginning of prog.
  1396.             HERE  JMPS  NEAR 10 + OFFSET HERE
  1397.                                   ;jump 10 bytes forward
  1398.  
  1399.  
  1400.           FAR
  1401.             Is the same as NEAR except changes the type to a
  1402.             far label.  Not used except for the PROC pseudo-
  1403.             op.
  1404.  
  1405.  
  1406.           BYTE
  1407.             Returns the value and type of its argument but
  1408.             changes the size to 8 bit.  Accepts memory
  1409.             operands and immediate data as arguments. Used
  1410.             mainly for defining the size of a memory operand
  1411.             when the size of the operation would be ambiguous
  1412.             otherwise.
  1413.  
  1414.                 MOV     BYTE [BX], 0    ;8 bit move
  1415.  
  1416.  
  1417.           WORD
  1418.             Same as BYTE but sets size to 16 bit.
  1419.  
  1420.  
  1421.           DWORD
  1422.             Same as BYTE but sets size to 32 bit.  Does not
  1423.             allow immediate data as an argument.  Used mainly
  1424.             to specify an indirect intersegment call/jump
  1425.             instruction.
  1426.  
  1427.                 CALL   DWORD [BX]  ;intersegment (far) jump
  1428.  
  1429.  
  1430.           QWORD
  1431.             Same as DWORD but sets size to 64 bit.  Used for
  1432.             long real and long integer 8087 operands.  Note:
  1433.             At the present time 8087 operands are not
  1434.             officially implemented by WASM.
  1435.  
  1436.  
  1437.  
  1438.  
  1439.  
  1440.  
  1441.           Special Operands                                  20
  1442.  
  1443.           TBYTE
  1444.             Same as DWORD but sets size to 80 bit.  Used for
  1445.             temporary real and BCD 8087 operands.  Note: At
  1446.             the present time 8087 operands are not officially
  1447.             implemented by WASM.
  1448.  
  1449.  
  1450.           ANYSIZE
  1451.             Same as BYTE but sets size to all allowable sizes.
  1452.             Used mainly to declare a memory location that is
  1453.             being used for more than one size.
  1454.  
  1455.             DATA  LABEL   ANYSIZE         ;data can be any size
  1456.                   DS      2    ;this is the area marked by DATA
  1457.  
  1458.             ;both of these assignments will work correctly
  1459.                   MOV     AL,DATA         ;8 bit move
  1460.                   MOV     AX,DATA         ;16 bit move
  1461.  
  1462.  
  1463.  
  1464.  
  1465.  
  1466.  
  1467.  
  1468.  
  1469.  
  1470.  
  1471.  
  1472.  
  1473.  
  1474.  
  1475.  
  1476.  
  1477.  
  1478.  
  1479.  
  1480.  
  1481.  
  1482.  
  1483.  
  1484.  
  1485.  
  1486.  
  1487.  
  1488.  
  1489.  
  1490.  
  1491.  
  1492.  
  1493.  
  1494.  
  1495.  
  1496.  
  1497.  
  1498.  
  1499.  
  1500.  
  1501.           Combining Operands                                21
  1502.  
  1503.           Operands may consist of one or more expressions
  1504.           added (+), subtracted (-), multiplied (*), or
  1505.           divided (/) together to form an extended operand.
  1506.           Only near labels, far labels, memory labels, and
  1507.           immediate data can have additional expressions
  1508.           combined to them.  All expressions after the first
  1509.           can only be immediate data.  Any number of spaces
  1510.           may be between the expressions and their
  1511.           corresponding operators (the + ,-, *, or /).  No
  1512.           commas may be used within a sequence of expressions
  1513.           (commas cause the final evaluation of an operand,
  1514.           thus terminating an extended operand).  All extended
  1515.           operands are evaluated sequentially from left to
  1516.           right (parenthesis are not allowed).
  1517.  
  1518.           Special operands may be used within extended
  1519.           operands.  Arguments for special operands themselves
  1520.           cannot be extended, i.e. the statement MOV AX,NOT
  1521.           1+1 is interpreted as MOV AX,(NOT 1) + 1.
  1522.  
  1523.           If any expression of an extended operand is signed,
  1524.           the operand as a whole is considered signed.  It's a
  1525.           good idea to make the first expression of an
  1526.           extended operand signed if the operand as a whole
  1527.           should be considered signed.
  1528.  
  1529.           Examples:
  1530.  
  1531.                   MOV     AX,1+1          ;move 2 into AX
  1532.                   MOV     SI,-6 + +3 / -1 * 2 + -6
  1533.                                           ;move 0 into SI
  1534.  
  1535.                   ADD     BYTE DATA+1, 3  ;adds three to high
  1536.                                           ;byte of DATA
  1537.           DATA    DW      0
  1538.  
  1539.  
  1540.  
  1541.  
  1542.  
  1543.  
  1544.  
  1545.  
  1546.  
  1547.  
  1548.  
  1549.  
  1550.  
  1551.  
  1552.  
  1553.  
  1554.  
  1555.  
  1556.  
  1557.  
  1558.  
  1559.  
  1560.  
  1561.           Pseudo-Op Descriptions                            22
  1562.  
  1563.           Pseudo-op stands for pseudo operation.  Pseudo-ops
  1564.           are not generally instructions for the processor,
  1565.           but commands for the assembler.  The following are
  1566.           descriptions of all supported pseudo-ops:
  1567.  
  1568.  
  1569.           DB
  1570.             Declare bytes.  Includes the list of operands in
  1571.             in the object code.  There may be any number of
  1572.             operands (as long as they fit on one line).  The
  1573.             operands may be any combination of strings and 8
  1574.             bit immediate data.  A label that marks a DB is
  1575.             considered a memory label and the data may be
  1576.             accessed through the label.  The size of the label
  1577.             is defined to be 8 bit.
  1578.  
  1579.              MOV   AL,DATA1  ;move the value at DATA1 (48) to AL
  1580.              MOV   AL,DATA2  ;move the value at DATA2 (0) to AL
  1581.  
  1582.             DATA1  DB  '0'
  1583.             DATA2  DB  0
  1584.  
  1585.                    DB  'Data may',' ','be',32
  1586.                    DB  'strings',1fH+1,'and',100000B,'numbers.'
  1587.  
  1588.  
  1589.           DS
  1590.             Declare storage.  Includes the specified number of
  1591.             identically initialized bytes in the object code.
  1592.             There is one or two operands.  The first is the
  1593.             number of bytes to declare, it is required.  The
  1594.             second operand is optional.  It specifies what
  1595.             value the bytes should be initialized to.  If this
  1596.             operand is not included the bytes are initialized
  1597.             to zero.  A label that marks a DS is considered a
  1598.             memory label and the data may be accessed through
  1599.             the label.  The size of the label is left
  1600.             undefined.
  1601.  
  1602.                   DS      10H      ;declaring 16 bytes of 0
  1603.                   DS      10H,0FFH ;declaring 16 bytes of FFH
  1604.  
  1605.  
  1606.  
  1607.  
  1608.  
  1609.  
  1610.  
  1611.  
  1612.  
  1613.  
  1614.  
  1615.  
  1616.  
  1617.  
  1618.  
  1619.  
  1620.  
  1621.           Pseudo-Op Descriptions                            23
  1622.  
  1623.           DW
  1624.             Declare word.  Includes the list of operands as
  1625.             16 bit values in the object code.  There may be
  1626.             any number of immediate data operands (as long as
  1627.             they fit on one line).  A label that marks a DW is
  1628.             considered a memory label and the data may be
  1629.             accessed through the label.  The size of the label
  1630.             is defined to be 16 bit.
  1631.  
  1632.             ;this construction can be useful
  1633.             ;for tables of routines
  1634.                   DW   OFFSET ROUTINE_ONE
  1635.                   DW   OFFSET ROUTINE_TWO
  1636.                   DW   OFFSET ROUTINE_THREE
  1637.             ;or alternately
  1638.               DW  OFFSET ROUTINE_ONE,OFFSET ROUTINE_TWO, ...
  1639.  
  1640.                   MOV     AX,ONE  ;move value at ONE to AX
  1641.             ;these two lines produce the same effect
  1642.             ONE DW      1       ;0001
  1643.                 DB      1,0     ;low byte stored first, 0001
  1644.  
  1645.  
  1646.           ENDP
  1647.             End procedure.  Specifies the end of a procedure.
  1648.             It has no operands.  See PROC.
  1649.  
  1650.  
  1651.           EQU
  1652.             Equate symbol.  Assigns immediate data or a direct
  1653.             address to a symbol, such that the symbol may be
  1654.             used instead.  There is one operand, either
  1655.             immediate data or a number enclosed by brackets
  1656.             (direct address).  A label for an EQU is always
  1657.             required.  Equates need not be defined before they
  1658.             are used, unless they are used as operands for
  1659.             other equates.  It is standard practice, though
  1660.             not necessary, to declare all equates at the start
  1661.             of the program
  1662.  
  1663.             SYMBOL1       EQU     1
  1664.             MEM_SIZE      EQU     WORD [2]
  1665.  
  1666.                   MOV     AX,SYMBOL1      ;move 1 to AX
  1667.                   MOV     BYTE [SI+SYMBOL1],SYMBOL1
  1668.                                             ;move 1 to [SI+1]
  1669.                   MOV     DX,MEM_SIZE     ;move memory size
  1670.                                           ;from PSP to DX
  1671.  
  1672.  
  1673.  
  1674.  
  1675.  
  1676.  
  1677.  
  1678.  
  1679.  
  1680.  
  1681.           Pseudo-Op Descriptions                            24
  1682.  
  1683.           ERRORMAX
  1684.             Define maximum allowed errors. Sets the maximum
  1685.             allowed errors before halting the assembly and
  1686.             displaying "Too many errors."  The single operand
  1687.             is a 16 (or 8) bit immediate data operand, the
  1688.             number of errors to allow.  This instruction is
  1689.             useful for those of you who are particularly
  1690.             sensitive to errors.  The default setting is
  1691.             65535.
  1692.  
  1693.               ERRORMAX  0  ;for someone who simply cannot
  1694.                            ;stand the sight of errors,
  1695.                            ;actually halts assembly after the
  1696.                            ;first error, is same as ERRORMAX 1
  1697.  
  1698.  
  1699.           INCLUDE
  1700.             Include source code.  Inserts the indicated source
  1701.             file immediately after the include.  The single
  1702.             operand is a string containing the name of the
  1703.             file to be included.  The extension and drive of
  1704.             the source file are used if none are specified.
  1705.             The entire file is inserted.  Included files
  1706.             cannot have any INCLUDE's themselves.  See the
  1707.             Assembly Listing section on how INCLUDE's affect
  1708.             the list output.  Includes are useful for
  1709.             inserting source code that is used by many
  1710.             different programs.  They are also useful for
  1711.             breaking up large programs and then including all
  1712.             the pieces together at assembly.
  1713.  
  1714.             ;include file EXTRA using source drive and extension
  1715.                   INCLUDE    'EXTRA'
  1716.  
  1717.             ;include file EXTRA.INC using the source drive
  1718.                   INCLUDE    'EXTRA.INC'
  1719.  
  1720.  
  1721.  
  1722.  
  1723.  
  1724.  
  1725.  
  1726.  
  1727.  
  1728.  
  1729.  
  1730.  
  1731.  
  1732.  
  1733.  
  1734.  
  1735.  
  1736.  
  1737.  
  1738.  
  1739.  
  1740.  
  1741.           Pseudo-Op Descriptions                            25
  1742.  
  1743.           LABEL
  1744.             Label definition.  Allows the definition of a
  1745.             particular type of label.  The single operand is
  1746.             one of the following: NEAR, FAR, BYTE, WORD,
  1747.             DWORD, QWORD, TBYTE, or ANYSIZE.  The label of the
  1748.             LABEL instruction becomes a near or far label if
  1749.             either of those operands are used.  If a size
  1750.             operand is used, the label becomes a memory label
  1751.             of the indicated size.  The location assigned to
  1752.             the label is the present value of the location
  1753.             counter (just as if the label was marking a line
  1754.             of code or data).  LABEL, of course, always
  1755.             requires a label.  LABEL is useful for creating a
  1756.             memory label of a specific size that marks the
  1757.             beginning of a data area.
  1758.  
  1759.             ;storage area of 5 words
  1760.             WORDS         LABEL   WORD
  1761.                           DS      10
  1762.  
  1763.             ;MEM_SIZE marks the memory size word in the PSP
  1764.                           ORG     2
  1765.             MEM_SIZE      LABEL   WORD
  1766.  
  1767.             ;these two near labels mark a location in the code
  1768.             JUMPLOC1   ;WASM interprets this as the thing below
  1769.             JUMPLOC2  LABEL  NEAR  ;this is more technically correct
  1770.  
  1771.  
  1772.           LINESIZE
  1773.             Line size setting.  Sets the listing width.  Has
  1774.             one or more 8 bit immediate data operands.  The
  1775.             first operand is the actual width, the following
  1776.             operands are printer set-up codes.  The printer
  1777.             set-up codes are sent directly to the printer if
  1778.             (and only if) the list file was specified as PRN.
  1779.             The width includes the entire list line (location
  1780.             counter, object code, etc.).  If a list line is
  1781.             greater then the width, it is truncated
  1782.             appropriately.  The minimum width is 50 and the
  1783.             maximum width is 254.  The default width setting
  1784.             is 79.  LINESIZE is useful for generating a
  1785.             listing of source code with extra long lines.
  1786.  
  1787.                   LINESIZE   79    ;default
  1788.  
  1789.             ;compressed width of IBM matrix printer, 15 is the
  1790.             ;control code to make printer print in compressed
  1791.             ;mode
  1792.                   LINESIZE   132,15
  1793.  
  1794.  
  1795.  
  1796.  
  1797.  
  1798.  
  1799.  
  1800.  
  1801.           Pseudo-Op Descriptions                            26
  1802.  
  1803.           LIST+, LIST-
  1804.             List on, list off.  LIST+ turns the listing on and
  1805.             LIST- turns the listing off.  There are no
  1806.             operands for either pseudo-op.  If no file has
  1807.             been specified for list output and a LIST+ is
  1808.             encountered, the listing will be activated and
  1809.             sent to the screen.  The list pseudo-ops are
  1810.             useful when only a partial listing of a program is
  1811.             desired.
  1812.  
  1813.  
  1814.           ORG
  1815.             Origin.  Allows modification of the location
  1816.             counter by the source code.  It has one 16 (or 8)
  1817.             bit immediate data operand.  The default starting
  1818.             location is 100H, which is the offset that COM
  1819.             files are loaded.  Origin is used mainly for
  1820.             programs that aren't meant to be COM files.  Also
  1821.             used for defining labels via the LABEL pseudo-op.
  1822.  
  1823.                   ORG    0    ;this begins a BASIC subroutine
  1824.  
  1825.  
  1826.           PAGE+/PAGE-
  1827.             Page on, page off.  PAGE+ turns the automatic
  1828.             paging of the list output on and PAGE- turns the
  1829.             paging off.  PAGE+ has an optional 16 (or 8) bit
  1830.             immediate data operand and an optional string
  1831.             operand.  If the immediate data operand is
  1832.             included it becomes the page number, otherwise the
  1833.             page is incremented from the last page number.  If
  1834.             the string operand is included it becomes the new
  1835.             subtitle at the top of the page, starting with the
  1836.             present page.  The immediate data operand must
  1837.             come before the string operand if both are
  1838.             included.  PAGE+ always starts a new page.
  1839.  
  1840.                 PAGE+      ;start paging using last page number
  1841.  
  1842.                 PAGE+   1  ;start paging with page one
  1843.  
  1844.                 PAGE-      ;stop paging
  1845.  
  1846.                 PAGE+   1,'Initialization Routine'
  1847.                            ;start paging with page 1 using the
  1848.                            ;subtitle "Initialization Routine"
  1849.  
  1850.  
  1851.  
  1852.  
  1853.  
  1854.  
  1855.  
  1856.  
  1857.  
  1858.  
  1859.  
  1860.  
  1861.           Pseudo-Op Descriptions                            27
  1862.  
  1863.           PAGE
  1864.             New page.  Starts a new page.  Has an optional 16
  1865.             (or 8) bit immediate data operand and an optional
  1866.             string operand.  If the immediate data operand is
  1867.             included it becomes the page number, otherwise the
  1868.             page is incremented from the last page number.  If
  1869.             the string operand is included it becomes the new
  1870.             subtitle at the top of the page, starting with the
  1871.             present page.  The immediate data operand must
  1872.             come before the string operand if both are
  1873.             included.
  1874.  
  1875.                 PAGE       ;start a new page, incrementing
  1876.                            ;from last page number
  1877.  
  1878.                 PAGE    1  ;start a new page with page one
  1879.  
  1880.                 PAGE    'Data'  ;start new page with
  1881.                                 ;"Data" as the subtitle, this
  1882.                                 ;is probably the best way to
  1883.                                 ;start a new section of the
  1884.                                 ;program
  1885.  
  1886.                 PAGE    1,'Data' ;start a new page with page
  1887.                                  ;one and "Data" as the
  1888.                                  ;subtitle
  1889.  
  1890.  
  1891.           PAGESIZE
  1892.             Define page size.  Sets the number of lines per
  1893.             page.  Has one 8 bit immediate data operand.  The
  1894.             lines per page include the lines of the title,
  1895.             subtitle, list heading, etc.  The minimum page
  1896.             size is 15 and the maximum page size is 255.  The
  1897.             default page size is 60.
  1898.  
  1899.                PAGESIZE    255   ;this makes very long pages
  1900.  
  1901.  
  1902.  
  1903.  
  1904.  
  1905.  
  1906.  
  1907.  
  1908.  
  1909.  
  1910.  
  1911.  
  1912.  
  1913.  
  1914.  
  1915.  
  1916.  
  1917.  
  1918.  
  1919.  
  1920.  
  1921.           Pseudo-Op Descriptions                            28
  1922.  
  1923.           PROC
  1924.             Procedure begin.  Specifies the beginning of a
  1925.             procedure.  It has one operand which is either
  1926.             NEAR or FAR.  The operand determines the type of
  1927.             returns that will be used for the RET's within the
  1928.             procedure and the type of the label (if any) that
  1929.             marks the PROC statement.  NEAR means within
  1930.             segment and FAR means intersegment.  The main
  1931.             program is usually a FAR procedure, while the
  1932.             subroutines within it are usually NEAR procedures.
  1933.             ENDP is used to terminate a procedure.  Procedures
  1934.             may be nested 10 deep.
  1935.  
  1936.                       PROC    FAR
  1937.                       :
  1938.               <main body of program>
  1939.                       :
  1940.  
  1941.             SUBROUT   PROC    NEAR
  1942.                       :
  1943.                   <subroutine>
  1944.                       :
  1945.                       ENDP    ;end of subroutine
  1946.  
  1947.                       ENDP    ;end of main program
  1948.  
  1949.  
  1950.           SUBTITLE
  1951.             Subtitle setting.  Sets the subtitle for the start
  1952.             of each following page.  The single string operand
  1953.             becomes the new subtitle.  Note that SUBTITLE sets
  1954.             the subtitle for the following page, not the page
  1955.             that the SUBTITLE statement appears; because of
  1956.             this reason setting the subtitle may be better
  1957.             serviced by the other pseudo-ops that can do the
  1958.             same thing (TITLE, PAGE, and PAGE+).  The SUBTITLE
  1959.             pseudo-op is optional.  If not included in the
  1960.             program the subtitle will be blank.
  1961.  
  1962.               SUBTITLE  'Chapter 1'  ;subtitle for all
  1963.                                      ;following pages becomes
  1964.                                      ;"Chapter 1"
  1965.  
  1966.  
  1967.           TITLE
  1968.             Title setting.  Sets the title for the start of
  1969.             each page.  Has one or two string operands.  The
  1970.             first is required and becomes the title.  The
  1971.             second is optional and becomes subtitle for the
  1972.             initial starting page.  Though the SUBTITLE, PAGE,
  1973.             and PAGE+ pseudo-ops can all set the subtitle,
  1974.             none of them can set the subtitle of the initial
  1975.             starting page.  The TITLE pseudo-op is optional.
  1976.             If not included in the program the title will be
  1977.             blank.  Only one title statement works, i.e. the
  1978.             entire program uses the same title.
  1979.  
  1980.               TITLE 'Super Program','Starting Subtitle'
  1981.           WASM Instruction Set                              29
  1982.  
  1983.           This section is not intended to fully describe the
  1984.           function of the 8088 instructions, but only list the
  1985.           way WASM implements each one.  For a comprehensive
  1986.           description of the 8088 instructions get a book on
  1987.           the subject.  The pseudo operations are fully
  1988.           described under in the Pseudo-Op Descriptions
  1989.           section.  See also the Source Code Clarification
  1990.           section for possible enlightenment on the
  1991.           differences between WASM and other assembler
  1992.           conventions.
  1993.  
  1994.           Instruction Format:
  1995.  
  1996.             <mnemonic> = <short description>
  1997.               <operand> [,<operand>] [=<comment>]
  1998.  
  1999.           Operand Types:
  2000.  
  2001.                   none      no operands
  2002.                   reg       register (non-segment)
  2003.                   seg       segment register
  2004.                   acum      AX or AL
  2005.                   mem       memory operand
  2006.                   immed     immediate data
  2007.                   string    string data
  2008.  
  2009.           Operands separated by slashes mean that either type
  2010.           may be used.  Operands in capital letters are the
  2011.           literal operands accepted.  Operands in brackets are
  2012.           optional, all others are required.
  2013.  
  2014.           Numbers in parenthesis indicate the allowable size
  2015.           (number of bits) for the specified operands.  If no
  2016.           size is given then the operands may be either 8 or
  2017.           16 bit (where applicable).
  2018.  
  2019.  
  2020.                                Pseudo-Ops
  2021.  
  2022.           DB = declare bytes
  2023.             immed(8)/string [, immed(8)/string, ...]
  2024.  
  2025.           DS = declare storage
  2026.             immed [, immed(8)] = second operand assumed 0
  2027.  
  2028.           DW = declare words
  2029.             immed [, immed, ...]
  2030.  
  2031.           ENDP = end of procedure
  2032.             none
  2033.  
  2034.           EQU = equate, requires label
  2035.             immed/mem = mem can only be a direct address
  2036.  
  2037.           ERRORMAX = set maximum errors, default 65335
  2038.             immed
  2039.  
  2040.  
  2041.           WASM Instruction Set                              30
  2042.  
  2043.           INCLUDE = include source file
  2044.             string = file name, default to source drive and ext
  2045.  
  2046.           LABEL = define label, requires label
  2047.             NEAR/FAR/BYTE/WORD/DWORD/QWORD/TBYTE/ANYSIZE
  2048.  
  2049.           LINESIZE = set output width, default 79
  2050.             immed(8) [, immed(8), ...] = width and printer codes
  2051.  
  2052.           LIST+ = list output on
  2053.             none
  2054.  
  2055.           LIST- = list output off
  2056.             none
  2057.  
  2058.           ORG = origin, default 100H
  2059.             immed
  2060.  
  2061.           PAGE = start new page
  2062.             [immed/string]  = page number, subtitle
  2063.             immed [, string] = page number, subtitle
  2064.  
  2065.           PAGE+ = start auto paging
  2066.             [immed/string]  = page number, subtitle
  2067.             immed [, string] = page number, subtitle
  2068.  
  2069.           PAGE- = stop auto paging, default setting
  2070.             none
  2071.  
  2072.           PAGESIZE = set lines per page, default 60
  2073.             immed
  2074.  
  2075.           PROC = beginning of procedure
  2076.             NEAR/FAR
  2077.  
  2078.           SUBTITLE = set program subtitle, default none
  2079.             string = subtitle
  2080.  
  2081.           TITLE = set program title, default none
  2082.             string [, string] = title, subtitle
  2083.  
  2084.  
  2085.                               Data Transfer
  2086.  
  2087.           IN = input
  2088.             acum, immed(8) = input from a fixed port
  2089.             acum, DX = input from a variable port in DX
  2090.  
  2091.           LAHF = load AH with flags
  2092.             none
  2093.  
  2094.           LDS = load DS and register (16)
  2095.             reg, reg/mem
  2096.  
  2097.           LEA = load effective address (16)
  2098.             reg, reg/mem
  2099.  
  2100.  
  2101.           WASM Instruction Set                              31
  2102.  
  2103.           LES = load ES and register (16)
  2104.             reg, reg/mem
  2105.  
  2106.           MOV = move
  2107.             reg/mem, reg/seg
  2108.             reg/seg, reg/mem
  2109.             reg/mem, immed
  2110.  
  2111.           OUT = output
  2112.             immed(8), acum = output to fixed port
  2113.             DX, acum = output to variable port in DX
  2114.  
  2115.           POP = pop (16)
  2116.             reg/seg/mem
  2117.  
  2118.           POPF = pop flags
  2119.             none
  2120.  
  2121.           PUSH = push (16)
  2122.             reg/seg/mem
  2123.  
  2124.           PUSHF = pop flags
  2125.             none
  2126.  
  2127.           SAHF = store AH to flags
  2128.             none
  2129.  
  2130.           XCHG = exchange
  2131.             reg/mem, reg
  2132.             reg, reg/mem
  2133.  
  2134.           XLAT = translate byte in AL
  2135.             none
  2136.  
  2137.                                 Arithmetic
  2138.  
  2139.           AAA = ASCII adjust for add
  2140.             none
  2141.  
  2142.           AAD = ASCII adjust for divide
  2143.             none
  2144.  
  2145.           AAM = ASCII adjust for multiply
  2146.             none
  2147.  
  2148.           AAS =  ASCII adjust for subtract
  2149.             none
  2150.  
  2151.           ADC = add with carry
  2152.             reg/mem, reg
  2153.             reg, reg/mem
  2154.             reg/mem, immed
  2155.  
  2156.           ADD = add
  2157.             reg/mem, reg
  2158.             reg, reg/mem
  2159.             reg/mem, immed
  2160.  
  2161.           WASM Instruction Set                              32
  2162.  
  2163.           CBW = convert byte to word
  2164.             none
  2165.  
  2166.           CWD = convert word to double word
  2167.             none
  2168.  
  2169.           DAA = decimal adjust for add
  2170.             none
  2171.  
  2172.           DAS = decimal adjust for subtract
  2173.             none
  2174.  
  2175.           DEC = decrement
  2176.             reg/mem
  2177.  
  2178.           DIV = divide, unsigned
  2179.             [acum,] reg/mem = acum implicit
  2180.  
  2181.           IDIV = integer divide, signed
  2182.             [acum,] reg/mem = acum implicit
  2183.  
  2184.           IMUL = integer multiply, signed
  2185.             [acum,] reg/mem = acum implicit
  2186.  
  2187.           INC = increment
  2188.             reg/mem
  2189.  
  2190.           MUL = multiply, unsigned
  2191.             [acum,] reg/mem = acum implicit
  2192.  
  2193.           NEG = decrement
  2194.             reg/mem
  2195.  
  2196.           SBB = subtract with borrow
  2197.             reg/mem, reg
  2198.             reg, reg/mem
  2199.             reg/mem, immed
  2200.  
  2201.           SUB = subtract
  2202.             reg/mem, reg
  2203.             reg, reg/mem,
  2204.             reg/mem, immed
  2205.  
  2206.  
  2207.                                   Logic
  2208.  
  2209.           AND = and
  2210.             reg/mem, reg
  2211.             reg, reg/mem
  2212.             reg/mem, immed
  2213.  
  2214.           NOT = not
  2215.             reg/mem
  2216.  
  2217.  
  2218.  
  2219.  
  2220.  
  2221.           WASM Instruction Set                              33
  2222.  
  2223.           OR = or
  2224.             reg/mem, reg
  2225.             reg, reg/mem
  2226.             reg/mem, immed
  2227.  
  2228.           RCL = rotate through carry left
  2229.             reg/mem = one time
  2230.             reg/mem, CL = CL times
  2231.  
  2232.           RCR = rotate through carry right
  2233.             reg/mem = one time
  2234.             reg/mem, CL = CL times
  2235.  
  2236.           ROL = rotate left
  2237.             reg/mem = one time
  2238.             reg/mem, CL = CL times
  2239.  
  2240.           ROR = rotate right
  2241.             reg/mem = one time
  2242.             reg/mem, CL = CL times
  2243.  
  2244.           SAL = shift arithmetic left
  2245.             reg/mem = one time
  2246.             reg/mem, CL = CL times
  2247.  
  2248.           SAR = shift arithmetic right
  2249.             reg/mem = one time
  2250.             reg/mem, CL = CL times
  2251.  
  2252.           SHL = shift logical left
  2253.             reg/mem = one time
  2254.             reg/mem, CL = CL times
  2255.  
  2256.           SHR = shift logical right
  2257.             reg/mem = one time
  2258.             reg/mem, CL = CL times
  2259.  
  2260.           XOR = xor
  2261.             reg/mem, reg
  2262.             reg, reg/mem
  2263.             reg/mem, immed
  2264.  
  2265.  
  2266.                               Flag Setting
  2267.  
  2268.           CLC = clear carry
  2269.             none
  2270.  
  2271.           CLD = clear direction
  2272.             none
  2273.  
  2274.           CLI = clear interrupt
  2275.             none
  2276.  
  2277.           CMC = clear complement carry
  2278.             none
  2279.  
  2280.  
  2281.           WASM Instruction Set                              34
  2282.  
  2283.           CMP = compare
  2284.             reg/mem, reg
  2285.             reg, reg/mem
  2286.             reg/mem, immed
  2287.  
  2288.           STC = set carry
  2289.             none
  2290.  
  2291.           STD = set direction
  2292.             none
  2293.  
  2294.           STI = set interrupt
  2295.             none
  2296.  
  2297.           TEST = test
  2298.             reg/mem, reg
  2299.             reg, reg/mem
  2300.             reg/mem, immed
  2301.  
  2302.  
  2303.                             Control Transfer
  2304.  
  2305.           CALL = call
  2306.             near = direct within segment
  2307.             immed (offset), immed (segment) = direct intersegment
  2308.             reg/mem = indirect within segment (16)
  2309.             mem = indirect intersegment (32)
  2310.  
  2311.           INT = interrupt
  2312.             immed(8)
  2313.  
  2314.           INT3 = type 3 interrupt
  2315.             none
  2316.  
  2317.           INTO = interrupt on overflow
  2318.             none
  2319.  
  2320.           IRET =interrupt return
  2321.             none
  2322.  
  2323.           JA = jump if above
  2324.             near
  2325.  
  2326.           JAE = jump if above or equal
  2327.             near
  2328.  
  2329.           JB = jump if below
  2330.             near
  2331.  
  2332.           JBE = jump if below or equal
  2333.             near
  2334.  
  2335.           JC = jump if carry
  2336.             near
  2337.  
  2338.           JCXZ = jump if CX equal to zero
  2339.             near
  2340.  
  2341.           WASM Instruction Set                              35
  2342.  
  2343.           JE = jump if equal
  2344.             near
  2345.  
  2346.           JG = jump if greater
  2347.             near
  2348.  
  2349.           JGE = jump if greater or equal
  2350.             near
  2351.  
  2352.           JL = jump if less
  2353.             near
  2354.  
  2355.           JLE = jump if less or equal
  2356.             near
  2357.  
  2358.           JMP = unconditional jump
  2359.             near = direct within segment
  2360.             immed (offset), immed (segment) = direct intersegment
  2361.             reg/mem = indirect within segment (16)
  2362.             mem = indirect intersegment (32)
  2363.  
  2364.           JMPS = unconditional short jump
  2365.             near
  2366.  
  2367.           JNA = jump if not above
  2368.             near
  2369.  
  2370.           JNAE = jump if not above or equal
  2371.             near
  2372.  
  2373.           JNB = jump if not below
  2374.             near
  2375.  
  2376.           JNBE = jump if not below or equal
  2377.             near
  2378.  
  2379.           JNC = jump if no carry
  2380.             near
  2381.  
  2382.           JNE = jump if not equal
  2383.             near
  2384.  
  2385.           JNG = jump if not greater
  2386.             near
  2387.  
  2388.           JNGE = jump if not greater or equal
  2389.             near
  2390.  
  2391.           JNL = jump if not less
  2392.             near
  2393.  
  2394.           JNLE = jump if not less or equal
  2395.             near
  2396.  
  2397.           JNO = jump if not overflow
  2398.             near
  2399.  
  2400.  
  2401.           WASM Instruction Set                              36
  2402.  
  2403.           JNP = jump if not parity
  2404.             near
  2405.  
  2406.           JNS = jump if not sign
  2407.             near
  2408.  
  2409.           JNZ = jump if not zero
  2410.             near
  2411.  
  2412.           JO = jump if overflow
  2413.             near
  2414.  
  2415.           JP = jump if parity
  2416.             near
  2417.  
  2418.           JPE = jump if parity even
  2419.             near
  2420.  
  2421.           JPO = jump if parity odd
  2422.             near
  2423.  
  2424.           JS = jump if sign
  2425.             near
  2426.  
  2427.           JZ = jump if zero
  2428.             near
  2429.  
  2430.           LOOP = loop CX times
  2431.             near
  2432.  
  2433.           LOOPE = loop while equal
  2434.             near
  2435.  
  2436.           LOOPNE = loop while not equal
  2437.             near
  2438.  
  2439.           LOOPNZ = loop while not zero
  2440.             near
  2441.  
  2442.           LOOPZ = loop while zero
  2443.             near
  2444.  
  2445.           RET = return, type determined by procedure
  2446.             none
  2447.             immed = add immed to stack
  2448.  
  2449.           RETF = within segment return
  2450.             none
  2451.             immed = add immed to stack
  2452.  
  2453.           RETN = intersegment return
  2454.             none
  2455.             immed = add immed to stack
  2456.  
  2457.  
  2458.  
  2459.  
  2460.  
  2461.           WASM Instruction Set                              37
  2462.  
  2463.                            String Manipulation
  2464.  
  2465.           CMPSB = compare string byte
  2466.             none
  2467.  
  2468.           CMPSW = compare string word
  2469.             none
  2470.  
  2471.           LODSB = load string byte
  2472.             none
  2473.  
  2474.           LODSW = load string word
  2475.             none
  2476.  
  2477.           MOVSB = move string byte
  2478.             none
  2479.  
  2480.           MOVSW = move string word
  2481.             none
  2482.  
  2483.           REP = repeat CX times
  2484.             none
  2485.  
  2486.           REPE = repeat while equal
  2487.             none
  2488.  
  2489.           REPNE = repeat while not equal
  2490.             none
  2491.  
  2492.           REPNZ = repeat while not zero
  2493.             none
  2494.  
  2495.           REPZ = repeat while zero
  2496.             none
  2497.  
  2498.           SCASB = scan string byte
  2499.             none
  2500.  
  2501.           SCASW = scan string word
  2502.             none
  2503.  
  2504.           STOSB = store string byte
  2505.             none
  2506.  
  2507.           STOSW = store string word
  2508.             none
  2509.  
  2510.  
  2511.                             Processor Control
  2512.  
  2513.           HLT = halt
  2514.             none
  2515.  
  2516.           LOCK = bus lock prefix
  2517.             none
  2518.  
  2519.  
  2520.  
  2521.           WASM Instruction Set                              38
  2522.  
  2523.           NOP = no operation
  2524.             none
  2525.  
  2526.           SEG = segment override prefix
  2527.             seg
  2528.  
  2529.           WAIT = wait
  2530.             none
  2531.  
  2532.  
  2533.  
  2534.  
  2535.  
  2536.  
  2537.  
  2538.  
  2539.  
  2540.  
  2541.  
  2542.  
  2543.  
  2544.  
  2545.  
  2546.  
  2547.  
  2548.  
  2549.  
  2550.  
  2551.  
  2552.  
  2553.  
  2554.  
  2555.  
  2556.  
  2557.  
  2558.  
  2559.  
  2560.  
  2561.  
  2562.  
  2563.  
  2564.  
  2565.  
  2566.  
  2567.  
  2568.  
  2569.  
  2570.  
  2571.  
  2572.  
  2573.  
  2574.  
  2575.  
  2576.  
  2577.  
  2578.  
  2579.  
  2580.  
  2581.           Source Code Clarification                         39
  2582.  
  2583.           Many of the conventions used by WASM are used by
  2584.           other assemblers and debuggers.  This section
  2585.           compares WASM to other assemblers and the DEBUG
  2586.           program provided with DOS.  This section also points
  2587.           out a few particulars of WASM syntax.
  2588.  
  2589.           Some assemblers add a suffix to the mnemonic to
  2590.           indicate the size of the operation, whether
  2591.           immediate data is involved, and the type of calls,
  2592.           jumps, and returns that are being used.  WASM
  2593.           identifies the type and size of the instruction
  2594.           mainly on the basis of the operands, in accordance
  2595.           with the DOS DEBUG program.
  2596.  
  2597.           WASM allows the user define the size of the operand
  2598.           through the use of a special operand (BYTE, WORD,
  2599.           etc.), this is very similar to the structure used
  2600.           by the DEBUG program and the IBM Macro Assembler.
  2601.  
  2602.           ; the following statement in WASM...
  2603.             MOV     WORD [5+SI+  10 +BP+5], NOT 1111111111111111B
  2604.  
  2605.           ; ...is disassembled as the following in DEBUG
  2606.           ; MOV     W,[BP+SI+14],0000          ;DOS 1.1 DEBUG
  2607.           ; MOV     WORD PTR [BP+SI+14],0000   ;DOS 2.0 DEBUG
  2608.  
  2609.           The size of the string manipulation instructions are
  2610.           specified by a B or W suffix added to the mnemonic.
  2611.           This is the same as the DEBUG program.
  2612.  
  2613.               MOVSB       ;move string byte
  2614.               MOVSW       ;move string word
  2615.  
  2616.           JMPS is the mnemonic that WASM uses to specify a
  2617.           short unconditional jump to a near label.  JMP
  2618.           always means a long jump.  The (DOS 2.0) DEBUG
  2619.           program uses JMP for both long and short jumps.
  2620.           Indirect calls and jumps are specified by the DEBUG
  2621.           program as either near (within segment) or far
  2622.           (intersegment).  WASM makes the distinction by the
  2623.           size of the operands, i.e. a 16 bit operand is near,
  2624.           and a 32 bit operand is far.
  2625.  
  2626.             CALL  OFF,SEG      ;direct call to OFF
  2627.                                ;offset and SEG segment
  2628.             JMPS  LOCATION1    ;short unconditional jump
  2629.             JMP   LOCATION1    ;long unconditional jump
  2630.             JMP   WORD [SI+BX] ;indirect jump in same segment
  2631.             CALL  DWORD [BX]   ;indirect intersegment call
  2632.  
  2633.  
  2634.  
  2635.  
  2636.  
  2637.  
  2638.  
  2639.  
  2640.  
  2641.           Source Code Clarification                         40
  2642.  
  2643.           WASM sets the type of return for a RET based on the
  2644.           last PROC (see the PROC pseudo-op in the Pseudo-Op
  2645.           Descriptions section).  A near (within segment) or
  2646.           far (intersegment) return may be encoded without
  2647.           using a PROC through the use of RETN and RETF
  2648.           respectively.  The DEBUG program uses RET to
  2649.           indicate a near return and a RETF to indicate a far
  2650.           return.
  2651.  
  2652.               PROC  FAR               ;<---
  2653.               RET         ;far return     ; far routine
  2654.               RETN        ;near return    ;
  2655.               RETF        ;far return     ;
  2656.                                           ;
  2657.               PROC  NEAR                  ; <---
  2658.               RET         ;near return    ;    ; near routine
  2659.               RETN        ;near return    ;    ;
  2660.               RETF        ;far return     ;    ;
  2661.               ENDP                        ; <---
  2662.                                           ;
  2663.               RET         ;far return     ;
  2664.               ENDP                    ;<---
  2665.  
  2666.           The bit shifting instructions (SHL, SHR, ROL, etc.)
  2667.           are interpreted to be a single shift by WASM if
  2668.           there is only one operand (the operand to be
  2669.           shifted).  Shifts using the CL register to count the
  2670.           shift are implemented by specifying CL as a second
  2671.           operand.  The DEBUG program requires a "1" as a
  2672.           second operand to specify a single shift.
  2673.  
  2674.              ROL     AX      ;roll AX left by one
  2675.           ;  ROL     AX,1    ;roll AX left by one, DEBUG format
  2676.              SHR     BYTE [BX],CL   ;shift 8 bits at [BX] CL times
  2677.  
  2678.           Some assemblers leave out an operand if the operand
  2679.           is implicit in the instruction.  AX is implicit in
  2680.           the following instructions: IN, OUT, MUL, IMUL, DIV,
  2681.           and IDIV.  WASM requires the AX (or AL) register in
  2682.           the IN and OUT instructions but allows the others
  2683.           with or without it.  The DEBUG program leaves out
  2684.           the AX or AL register on multiply or divide
  2685.           instructions, but does not on the others.
  2686.  
  2687.              IN    AX,DX   ;AX recieves input word from port in DX
  2688.  
  2689.           ;both of the following are: AX = AX x CX
  2690.              MUL   AX,CX   ;WASM allows this
  2691.              MUL   CX      ;WASM and DEBUG allow this
  2692.  
  2693.  
  2694.  
  2695.  
  2696.  
  2697.  
  2698.  
  2699.  
  2700.  
  2701.           Source Code Clarification                         41
  2702.  
  2703.           WASM and DEBUG implement instruction prefixes as a
  2704.           separate instruction, i.e. they appear on the line
  2705.           above the instruction to modify.  The prefixes are:
  2706.           LOCK, REP, REPE, REPNE, REPNZ, REPZ, and SEG.
  2707.  
  2708.                   REP
  2709.                   STOSB           ;store byte CX times
  2710.  
  2711.                   SEG     SS
  2712.                   MOV     AX,[BX] ;[BX] is in the stack segment
  2713.  
  2714.           WASM and DEBUG both specify indirect memory operands
  2715.           by putting all values and registers inside the
  2716.           brackets.
  2717.  
  2718.           ;this in WASM ...
  2719.                   SUB     [BX+10],AX
  2720.                   SUB     [BX+DATA],AX
  2721.           ;... may be implemented by others like one of these
  2722.           ;       SUB     [BX]+10,AX
  2723.           ;       SUB     10[BX],AX
  2724.           ;       SUB     DATA[BX],AX
  2725.  
  2726.           DATA    LABEL   WORD
  2727.  
  2728.           The mnemonic for an optimized type 3 interrupt is
  2729.           INT3.
  2730.  
  2731.           ;both of statements these cause type 3 interrupts,
  2732.           ;but the first uses only one byte of code
  2733.                   INT3
  2734.                   INT     3
  2735.  
  2736.           WASM assumes the entire program and all data are in
  2737.           the same segment, so there are no segment
  2738.           definitions.  The location counter is automatically
  2739.           started at 100H, in accordance with COM file format.
  2740.  
  2741.           Note that several WASM instructions mean the same
  2742.           thing as other instructions and produce identical
  2743.           object code.  The DEBUG program always disassembles
  2744.           these instructions using one particular mnemonic.
  2745.           One example is JNLE (jump not less or equal) and JG
  2746.           (jump greater).  The DEBUG program disassembles both
  2747.           of these instructions as JG.
  2748.  
  2749.  
  2750.  
  2751.  
  2752.  
  2753.  
  2754.  
  2755.  
  2756.  
  2757.  
  2758.  
  2759.  
  2760.  
  2761.           Source Code Clarification                         42
  2762.  
  2763.           There is an uncaught error for certain registers as
  2764.           operands.  When the operand DX is used in IN's and
  2765.           OUT's, and CL is used for shifts and rolls, WASM
  2766.           only looks for a register type, not those particular
  2767.           registers.  This means that in those cases any
  2768.           register will work in place of a DX or CL (except a
  2769.           segment register).  Also WASM does not search for
  2770.           extra operands, they do not cause errors if they
  2771.           are there.
  2772.  
  2773.           ;some uncaught errors
  2774.              IN    AX,BX
  2775.              SHL   AX,BX
  2776.              MOV   AX,BX,CX,DX
  2777.  
  2778.  
  2779.  
  2780.  
  2781.  
  2782.  
  2783.  
  2784.  
  2785.  
  2786.  
  2787.  
  2788.  
  2789.  
  2790.  
  2791.  
  2792.  
  2793.  
  2794.  
  2795.  
  2796.  
  2797.  
  2798.  
  2799.  
  2800.  
  2801.  
  2802.  
  2803.  
  2804.  
  2805.  
  2806.  
  2807.  
  2808.  
  2809.  
  2810.  
  2811.  
  2812.  
  2813.  
  2814.  
  2815.  
  2816.  
  2817.  
  2818.  
  2819.  
  2820.  
  2821.           Errors: Message Format                            43
  2822.  
  2823.           Errors detected in the source code cause the output
  2824.           of an error message and then the line that caused
  2825.           the error.  A line may have more than one error
  2826.           message.  Note that paging occurs indiscriminately
  2827.           so that the error(s) for a line may be on a
  2828.           different page then the line itself.
  2829.  
  2830.           Error messages and the line being flagged are output
  2831.           even if there is no listing otherwise being
  2832.           generated.
  2833.  
  2834.           If an error causes the premature termination of the
  2835.           assembly, WASM prints the error message on the
  2836.           screen along with ">>>Cannot Continue<<<" and a
  2837.           beep.
  2838.  
  2839.           Diagnostics are output in a similar manner to
  2840.           errors.  Diagnostics are provided as helpful advice
  2841.           and do not in themselves constitute an error.
  2842.  
  2843.  
  2844.  
  2845.  
  2846.  
  2847.  
  2848.  
  2849.  
  2850.  
  2851.  
  2852.  
  2853.  
  2854.  
  2855.  
  2856.  
  2857.  
  2858.  
  2859.  
  2860.  
  2861.  
  2862.  
  2863.  
  2864.  
  2865.  
  2866.  
  2867.  
  2868.  
  2869.  
  2870.  
  2871.  
  2872.  
  2873.  
  2874.  
  2875.  
  2876.  
  2877.  
  2878.  
  2879.  
  2880.  
  2881.           Errors: Messages                                  44
  2882.  
  2883.           A file cannot be included by an included file
  2884.             Source code that was included into the main
  2885.             program by an INCLUDE contained an INCLUDE.
  2886.             Included files cannot have any INCLUDE's.
  2887.  
  2888.           Address error
  2889.             There was some kind of error in the addressing
  2890.             operands, probably an illegal combination of
  2891.             registers such as [BX+BP].
  2892.  
  2893.           Ambiguous memory reference
  2894.             The size of an operand was found to be undefined
  2895.             when it shouldn't be.  Usually occurs when the
  2896.             operands are a memory operand and immediate data,
  2897.             and the size of the prior is not defined.  Also
  2898.             occurs if the operand for a LABEL statement is
  2899.             missing.
  2900.  
  2901.           Cannot create list file: <file name>
  2902.             WASM was unable to create or open the specified
  2903.             list file.  Could be an error in the file name.
  2904.             The file name is displayed.  Critical error.
  2905.  
  2906.           Cannot create object file: <file name>
  2907.             WASM was unable to create or open the specified
  2908.             object file.  Could be an error in the file name.
  2909.             The file name is displayed.  Critical error.
  2910.  
  2911.           Could use JMPS: <offset>
  2912.             A diagnostic offered when the displacement of the
  2913.             jump was found to be small enough to use the short
  2914.             unconditional jump (JMPS).  The hexadecimal number
  2915.             displayed is the offset.  Though the present code
  2916.             is not incorrect, changing the instruction to a
  2917.             JMPS would save a byte of object code.
  2918.  
  2919.           Data too long in declaration: <value>
  2920.           Data too long in declaration: <operand>
  2921.             The first version is caused by the second operand
  2922.             in a DS being more than a byte long.  WASM
  2923.             displays the hexadecimal value of the operand.
  2924.             The second version is caused when an operand in a
  2925.             DB is more then a byte long.  The operand itself
  2926.             is displayed.
  2927.  
  2928.           Disk full or write error: <file name>
  2929.             For some reason WASM could not successfully write
  2930.             to the list or object file.  The file name is
  2931.             displayed.  Usually means that the disk is full.
  2932.             Critical error.
  2933.  
  2934.           Division by zero: <expression>
  2935.             The divisor of a division operation within an
  2936.             extended operand was found to be zero.  The
  2937.             division is ignored and the expression which is
  2938.             equal to zero is displayed.
  2939.  
  2940.  
  2941.           Errors: Messages                                  45
  2942.  
  2943.           Duplicate definition: <symbol>
  2944.             A symbol was defined more than once.  Each
  2945.             definition is flagged.  One of the occurrences must
  2946.             be differentiated from the other to fix the error.
  2947.             All symbols must be unique from each other.
  2948.  
  2949.           ENDP without PROC
  2950.             An ENDP was found without a PROC to match it.
  2951.  
  2952.           EQU without label
  2953.             The line contains an EQU but doesn't have a label.
  2954.             An EQU is meaningless without a label, thus labels
  2955.             are always required.
  2956.  
  2957.           Illegal addressing operand: <operand>
  2958.             The displayed operand was used in addressing
  2959.             (found between brackets) but is not a legal
  2960.             addressing operand.
  2961.  
  2962.           Illegal argument for ANYSIZE: <operand>
  2963.             The displayed operand was given as an argument for
  2964.             ANYSIZE but is not immediate data or a memory
  2965.             operand.
  2966.  
  2967.           Illegal argument for BYTE: <operand>
  2968.             The displayed operand was given as an argument for
  2969.             BYTE but is not immediate data or a memory
  2970.             operand.
  2971.  
  2972.           Illegal argument for DWORD: <operand>
  2973.             The displayed operand was given as an argument for
  2974.             DWORD but is not a memory operand.
  2975.  
  2976.           Illegal argument for FAR: <operand>
  2977.             The displayed operand was given as an argument for
  2978.             FAR but is not a near label, far label, memory
  2979.             label, or immediate data.
  2980.  
  2981.           Illegal argument for NEAR: <operand>
  2982.             The displayed operand was given as an argument for
  2983.             NEAR but is not a near label, far label, memory
  2984.             label, or immediate data.
  2985.  
  2986.           Illegal argument for NOT: <operand>
  2987.             The displayed operand was given as an argument for
  2988.             NOT but is not immediate data.
  2989.  
  2990.           Illegal argument for OFFSET: <operand>
  2991.             The displayed operand was given as an argument for
  2992.             OFFSET but is not a near, far, or memory label.
  2993.  
  2994.           Illegal argument for QWORD: <operand>
  2995.             The displayed operand was given as an argument for
  2996.             QWORD but is not a memory operand.  Note: At the
  2997.             present time 8087 operands are not officially
  2998.             implemented by WASM.
  2999.  
  3000.  
  3001.           Errors: Messages                                  46
  3002.  
  3003.           Illegal argument for ST: <operand>
  3004.             The stack offset (the i in ST(i)) of an 8087 stack
  3005.             operand was not immediate data in the range 0 to
  3006.             7.  Note: At the present time 8087 operands are
  3007.             not officially implemented by WASM.
  3008.  
  3009.           Illegal argument for TBYTE: <operand>
  3010.             The displayed operand was given as an argument for
  3011.             TBYTE but is not a memory operand.  Note: At the
  3012.             present time 8087 operands are not officially
  3013.             implemented by WASM.
  3014.  
  3015.           Illegal argument for WORD: <operand>
  3016.             The displayed operand was given as an argument for
  3017.             WORD but is not immediate data or a memory
  3018.             operand.
  3019.  
  3020.           Illegal number or symbol: <operand>: <character>
  3021.             The displayed operand begins begins with a 0
  3022.             through 9 but is not a legal number (contains a
  3023.             non-numeric character).  Following the operand is
  3024.             the specific character causing the error.  Symbols
  3025.             cannot start with a 0 through 9, and any operand
  3026.             that does is assumed to be a number.  Make sure
  3027.             that hexadecimal numbers end with an H and have a
  3028.             preceding 0 (if the first character would
  3029.             otherwise be an A through F).
  3030.  
  3031.           Illegal operand in declaration: <operand>
  3032.             The displayed operand was used in a DB but is not
  3033.             immediate data or a string, or was used in a DW
  3034.             and is not immediate data.
  3035.  
  3036.           Illegal operand(s)
  3037.             WASM was unable to find a version of the
  3038.             instruction that used the same operands as those
  3039.             in the source code.  Is probably because one or
  3040.             more of the operands are the wrong type or size,
  3041.             but also may be because there are too few operands
  3042.             for the instruction.  Often be due to other errors
  3043.             in the statement.
  3044.  
  3045.  
  3046.  
  3047.  
  3048.  
  3049.  
  3050.  
  3051.  
  3052.  
  3053.  
  3054.  
  3055.  
  3056.  
  3057.  
  3058.  
  3059.  
  3060.  
  3061.           Errors: Messages                                  47
  3062.  
  3063.           Illegal operator or symbol: <character>
  3064.             The displayed character was in the position of a
  3065.             sign or operator but is illegal for some reason.
  3066.             May be because of multiple operators (signs) for a
  3067.             single operand like MOV AL,--1. May be because
  3068.             there is a sign for a special operand (special
  3069.             operands may not be signed, though arguments can
  3070.             be).  May be because of an inappropriate bracket
  3071.             like MOV ] AX,0.  Also occurs if the operator
  3072.             within an address operand is illegal or missing
  3073.             like MOV AX,[BX SI] or MOV AX,[BX-SI].  Symbols
  3074.             may not contain any operators, brackets or other
  3075.             special characters.  These types of illegal
  3076.             characters in a symbol results in an uncaught
  3077.             error when the symbol is defined.  If such a
  3078.             symbol is used as an operand it will probably be
  3079.             parsed into separate pieces, possibly causing this
  3080.             error in the process.
  3081.  
  3082.           Illegal or undefined pseudo operation
  3083.             This error should never occur, if it does there is
  3084.             something wrong with WASM (namely that a pseudo-op
  3085.             has been included in the instruction set without
  3086.             informing WASM about it).
  3087.  
  3088.           Illegal printer code: <operand>
  3089.             The displayed operand was specified as a printer
  3090.             code (an extra width operand) but is not 8 bit
  3091.             immediate data.
  3092.  
  3093.           Illegal reference
  3094.             Occurs when the pass one value of an operand might
  3095.             be different than the pass two value in situations
  3096.             where it shouldn't be.  Specifically occurs if the
  3097.             OFFSET special operand is used for a DS, EQU, or
  3098.             an ORG.  Also occurs if the operand for an EQU is
  3099.             undefined at the time the EQU is defined.
  3100.  
  3101.           INCLUDE file not found: <file name>
  3102.             The file specified by the INCLUDE could not be
  3103.             found or could not be opened.  Could be an error
  3104.             in the file name.  The file name is displayed.
  3105.  
  3106.           INCLUDE pseudo-op disabled
  3107.             This error should never occur, if it does there is
  3108.             something wrong with WASM.  Occurs if INCLUDE has
  3109.             been disabled and then one is encountered.
  3110.             INCLUDE's cannot normally be disabled by the user.
  3111.  
  3112.           Invalid character in symbol: <symbol>
  3113.             The displayed symbol begins with a 0 through 9,
  3114.             which is reserved for numbers.  Symbols should
  3115.             begin with a letter.
  3116.  
  3117.  
  3118.  
  3119.  
  3120.  
  3121.           Errors: Messages                                  48
  3122.  
  3123.           Invalid operand size
  3124.             A diagnostic that is sometimes offered when an
  3125.             Illegal Operands error occurs.  It means that WASM
  3126.             found a version of the instruction that matched
  3127.             the source code in every way except in the size of
  3128.             one or more of the operands.  Adjusting the size
  3129.             might result in correct code.
  3130.  
  3131.           LABEL without label
  3132.             The line contains a LABEL but doesn't have a
  3133.             label.  LABEL is meaningless without a label, so
  3134.             labels are always required.
  3135.  
  3136.           LINESIZE out of range: <value>
  3137.             The operand for LINESIZE was too big or too small.
  3138.             LINESIZE must be in the range 50 to 254.  The
  3139.             decimal value of the operand is displayed.
  3140.  
  3141.           Missing ENDP: <number>
  3142.             The end of the source code was encountered but
  3143.             there were more PROC's than ENDP's.  The decimal
  3144.             number displayed is the number of missing ENDP's.
  3145.  
  3146.           Missing PROC
  3147.             A RET not inside a procedure (PROC...ENDP
  3148.             structure) was found.  The RET instruction needs a
  3149.             PROC to set the type of return.
  3150.  
  3151.           Missing right bracket
  3152.             An operand began with a left bracket, indicating a
  3153.             memory operand, but no matching right bracket was
  3154.             found before the end of the line was reached.
  3155.  
  3156.           Operand cannot be combined: <expression>
  3157.             The first expression of an extended operand was
  3158.             not a near label, far label, memory label, or
  3159.             immediate data.  Or the expression after the first
  3160.             was not immediate data.  The expression causing
  3161.             the error is displayed.
  3162.  
  3163.           Operands are incompatible sizes
  3164.             The sizes of the operands were found to be
  3165.             incompatible, like adding a 16 bit value to an 8
  3166.             bit location.
  3167.  
  3168.           Out of memory for symbol table: <symbol>: <number>
  3169.             The symbol table is full.  The symbol that would
  3170.             not fit is displayed.  Also displayed is the
  3171.             decimal number of symbols presently in the table.
  3172.             This error can only be fixed by reducing the
  3173.             number or length of the symbols in the program, or
  3174.             by increasing the amount of available memory.
  3175.             Critical error.
  3176.  
  3177.  
  3178.  
  3179.  
  3180.  
  3181.           Errors: Messages                                  49
  3182.  
  3183.           Overflow: <operand>
  3184.             A specific operand or an extended operand resulted
  3185.             in a value that was too big (or too small) to be
  3186.             represented by 16 bits.  The specific operand or
  3187.             expression causing the overflow is displayed.
  3188.             Unsigned values must be 0 to 65535, signed must be
  3189.             -32768 to +32767.  Note that if an extended
  3190.             operand contains any signed expressions the entire
  3191.             operand is considered signed.
  3192.  
  3193.           PAGESIZE out of range: <value>
  3194.             The operand for PAGESIZE was too big or too small.
  3195.             The number of lines per page must be in the range
  3196.             15 to 255.  The decimal value displayed is the
  3197.             value of the operand.
  3198.  
  3199.           Phase error: <value>
  3200.             The value of a label was found to be different on
  3201.             pass one and pass two.  Never caused by the line
  3202.             that gets flagged (error occurred sometime
  3203.             previously).  Clearing up other errors almost
  3204.             always fixes a phase error.  Phase errors can also
  3205.             result from statements like " ORG OFFSET label" or
  3206.             " DS OFFSET label" because the expression "OFFSET
  3207.             label" might return different values on different
  3208.             passes (screwing up the location counter).  The
  3209.             hexadecimal value displayed is the pass one value
  3210.             of the label, the pass two value is displayed on
  3211.             line itself.  The assembled code always uses the
  3212.             pass one value.  If a phase error occurs without
  3213.             any other errors it is possible that it is being
  3214.             caused by some error within WASM.
  3215.  
  3216.           Procedures nested too deeply: <level>
  3217.             The procedures within the program were nested too
  3218.             deeply. Procedures can only be nested ten deep.
  3219.             The PROC causing the error is ignored.  The
  3220.             decimal number displayed is the present nesting
  3221.             level, which should always be ten.
  3222.  
  3223.           Register overriding declared memory size
  3224.             A diagnostic to warn the user that a register is
  3225.             acting upon or being acted upon by a memory
  3226.             operand that has a different size.  This message
  3227.             can be avoided by redefining the size of the
  3228.             memory operand through the use of BYTE, WORD, or
  3229.             ANYSIZE (whichever is appropriate).
  3230.  
  3231.           Should be byte data
  3232.             The immediate data (port) of an IN or OUT did not
  3233.             have an 8 bit size.
  3234.  
  3235.           Source file not found: <file name>
  3236.             The source file was not found or could not be
  3237.             opened.  The name of the file is displayed.  Could
  3238.             be an error in the file name.  Critical error.
  3239.  
  3240.  
  3241.           Errors: Messages                                  50
  3242.  
  3243.           String not closed
  3244.             A single quote to start a string was found, but
  3245.             WASM did not find a matching quote to close the
  3246.             string.
  3247.  
  3248.           Syntax error: <mnemonic>
  3249.             The displayed mnemonic was not recognized as a
  3250.             legal WASM instruction.
  3251.  
  3252.           Too far for short jump: <offset>
  3253.             The offset of the jump is too far for a short
  3254.             jump.  If the instruction is a JMPS then JMP may
  3255.             be successfully substituted, otherwise the only
  3256.             way to correct this error is to somehow change the
  3257.             code so that the jump location is closer.  The
  3258.             hexadecimal displacement is displayed, which can
  3259.             give an idea of how much closer the jump location
  3260.             must be.  Short jumps must be in the range FF80 to
  3261.             007F hexadecimal (-128 to 127 decimal).
  3262.  
  3263.           Too many errors: <number>
  3264.             The number of errors detected exceeded or equaled
  3265.             the maximum number of errors set by ERRORMAX (or
  3266.             the default number of 65535). The number of errors
  3267.             is displayed.  Critical error.
  3268.  
  3269.           Undefined error
  3270.             This error should never happen.  If it does there
  3271.             is something wrong with WASM.  The error means
  3272.             that an error occurred for which there is no error
  3273.             message.
  3274.  
  3275.           Undefined symbol: <symbol>
  3276.             The displayed symbol was not a recognized operand
  3277.             type and not in the symbol table.
  3278.  
  3279.           Unexpected end of operand: <character>
  3280.             A special character (like +, /, *, etc) was found
  3281.             at the end of the line.  Either get rid of the
  3282.             character or put something after it.
  3283.  
  3284.           WASM detects checksum failure
  3285.             The internal checksum failed.  That particular
  3286.             copy of WASM.COM is no good (might have been
  3287.             garbled in transmission). Critical error.
  3288.  
  3289.           WASM detects insufficient memory
  3290.             There isn't enough available memory for WASM to
  3291.             run.  Requires more memory.  Critical error.
  3292.  
  3293.  
  3294.  
  3295.  
  3296.  
  3297.  
  3298.  
  3299.  
  3300.  
  3301.           Programming: Structure                            51
  3302.  
  3303.           When programming in assembler it is easy to give way
  3304.           to unstructured programming.  There is no implicit
  3305.           structure to assembler (as there is with Pascal, for
  3306.           instance).  For very short programs the structure is
  3307.           hardly significant, but the longer a program is the
  3308.           more important the structure becomes.  A structured
  3309.           program is much easier to understand and DEBUG.
  3310.  
  3311.           To assist in structured programming, the source code
  3312.           is broken up into procedures with PROC's and ENDP's.
  3313.           PROC defines the beginning of a procedure, and ENDP
  3314.           defines the end.  For every PROC there should be an
  3315.           ENDP.
  3316.  
  3317.           The whole program should be made a procedure
  3318.           containing smaller procedures within it.  A
  3319.           reasonable way to order a program might be: equates,
  3320.           code, subroutines and data.  A program might look
  3321.           something like this:
  3322.  
  3323.                   PROC    FAR     ;beginning of main program
  3324.                   :
  3325.                <equates>
  3326.                   :
  3327.  
  3328.                   :               ;<--
  3329.                   :                  ; main program
  3330.                 <code>               ;
  3331.                   :                  ;
  3332.                   INT     20H     ;<--
  3333.  
  3334.  
  3335.           SUBRNT  PROC    NEAR    ;<--
  3336.                   :                  ; SUBRNT subroutine
  3337.                 <code>               ;
  3338.                   :                  ;
  3339.                   :                  ;
  3340.                 <data>               ;
  3341.                   :                  ;
  3342.                   RET                ;
  3343.                   ENDP            ;<--
  3344.  
  3345.  
  3346.                   :
  3347.                 <data>
  3348.                   :
  3349.                   ENDP            ;end of main program
  3350.  
  3351.  
  3352.  
  3353.  
  3354.  
  3355.  
  3356.  
  3357.  
  3358.  
  3359.  
  3360.  
  3361.           Programming: Operating System Interface           52
  3362.  
  3363.           The DOS operating system creates and maintains the
  3364.           little world in which your program exists.  DOS
  3365.           creates a free segment within memory and sets all
  3366.           the segment registers to its location.  Then your
  3367.           program is loaded at offset 100H in that segment.
  3368.           The stack pointer is set to the top of the segment
  3369.           (you generally do not have to worry about the
  3370.           stack).  Finally your program is given control and
  3371.           execution begins with the instruction at 100H.
  3372.  
  3373.           Those first 100H bytes that are just in front of
  3374.           your program are called the program segment prefix
  3375.           (PSP).  The PSP contains many things that could be
  3376.           useful to your program, including any parameters
  3377.           entered when the program was executed.  The DOS
  3378.           manual explains the PSP.
  3379.  
  3380.  
  3381.  
  3382.  
  3383.  
  3384.  
  3385.  
  3386.  
  3387.  
  3388.  
  3389.  
  3390.  
  3391.  
  3392.  
  3393.  
  3394.  
  3395.  
  3396.  
  3397.  
  3398.  
  3399.  
  3400.  
  3401.  
  3402.  
  3403.  
  3404.  
  3405.  
  3406.  
  3407.  
  3408.  
  3409.  
  3410.  
  3411.  
  3412.  
  3413.  
  3414.  
  3415.  
  3416.  
  3417.  
  3418.  
  3419.  
  3420.  
  3421.           Programming: Interrupts                           53
  3422.  
  3423.           To communicate with the rest of the world your
  3424.           program uses interrupts.  Interrupts do things like
  3425.           printing characters to the screen, reading and
  3426.           writing to disk drives, and inputting what is being
  3427.           typed at the keyboard.
  3428.  
  3429.           There are interrupts provided by DOS and ROM BIOS.
  3430.           The DOS interrupts are explained in the back of the
  3431.           DOS manual and the BIOS interrupts are explained in
  3432.           the technical reference manual.
  3433.  
  3434.           Interrupts basically work by putting any required
  3435.           parameters into specified registers and calling the
  3436.           interrupt.
  3437.  
  3438.           An important interrupt that you should learn right
  3439.           away is interrupt 20H.  This interrupt properly
  3440.           terminates a program and gives control back to DOS.
  3441.           All programs that are meant to run directly from DOS
  3442.           should end with:
  3443.  
  3444.               INT  20H      ;exit to DOS
  3445.  
  3446.  
  3447.  
  3448.  
  3449.  
  3450.  
  3451.  
  3452.  
  3453.  
  3454.  
  3455.  
  3456.  
  3457.  
  3458.  
  3459.  
  3460.  
  3461.  
  3462.  
  3463.  
  3464.  
  3465.  
  3466.  
  3467.  
  3468.  
  3469.  
  3470.  
  3471.  
  3472.  
  3473.  
  3474.  
  3475.  
  3476.  
  3477.  
  3478.  
  3479.  
  3480.  
  3481.           Programming: BASIC Subroutines                    54
  3482.  
  3483.           Programs written in assembly language can be called
  3484.           from BASIC.  See the BASIC manual for details.  The
  3485.           user can easily make a machine language subroutine
  3486.           BLOADable by adding the proper header to the
  3487.           beginning of the program, which amounts to the
  3488.           following code at the start of the program:
  3489.  
  3490.              ORG     0               ;begin at offset 0
  3491.              DB      FDH             ;BLOAD marker
  3492.              DW      F000H           ;segment to load it at
  3493.              DW      0               ;offset to load it at
  3494.              DW      PROGRAM_SIZE    ;size of program
  3495.  
  3496.           The segment and offset of the load location can be
  3497.           any number, since it should be specified by the user
  3498.           when loading it from BASIC, though making the
  3499.           address F000:0000 (which is read only memory) will
  3500.           prevent loading it over something important if the
  3501.           address is not specified.
  3502.  
  3503.           Since BLOADable files are not directly executable,
  3504.           their extension should be something other than COM
  3505.           (the default).
  3506.  
  3507.  
  3508.  
  3509.  
  3510.  
  3511.  
  3512.  
  3513.  
  3514.  
  3515.  
  3516.  
  3517.  
  3518.  
  3519.  
  3520.  
  3521.  
  3522.  
  3523.  
  3524.  
  3525.  
  3526.  
  3527.  
  3528.  
  3529.  
  3530.  
  3531.  
  3532.  
  3533.  
  3534.  
  3535.  
  3536.  
  3537.  
  3538.  
  3539.  
  3540.  
  3541.           Programming: Debugging your program
  3542.  
  3543.           Writing a program and assembling it is just the
  3544.           first step to creating a working program.  To make
  3545.           that program function correctly usually requires
  3546.           some amount of debugging.  This is done with
  3547.           DEBUG.COM, a utility program that is very
  3548.           conveniently provided with DOS.  This program is
  3549.           just as important as the assembler itself.  With
  3550.           DEBUG you can watch the execution of your program
  3551.           and see exactly what it is (or isn't) doing.
  3552.  
  3553.           DEBUG is fully explained in the DOS manual.  A few
  3554.           of the most important commands are: (d)ump --
  3555.           display memory, (e)nter -- change memory, (g)o --
  3556.           execute code with breakpoints, (r)egister -- change
  3557.           and display register values, (t)race -- step through
  3558.           individual instructions, and (u)nassemble --
  3559.           displays memory as assembler like instructions.
  3560.  
  3561.           Remember that an assembled program looks quite a bit
  3562.           different than one unassembled by DEBUG.  Instead of
  3563.           branching to labels you are now branching to
  3564.           displacements (DEBUG translates the displacement
  3565.           into a memory location).  Also many instructions
  3566.           produce identical code, like:
  3567.  
  3568.              JC   xxxx    ;jump if carry
  3569.              JB   xxxx    ;jump if below
  3570.  
  3571.              JG   xxxx    ;jump if greater
  3572.              JNLE xxxx    ;jump if not less or equal
  3573.  
  3574.              XCHG AX,BX   ;exchange AX and BX
  3575.              XCHG BX,AX   ;exchange BX and AX
  3576.  
  3577.           When programming in assembler it is fairly easy to
  3578.           "crash" the system, mainly by executing non-code or
  3579.           falling into an infinite loop (you can't just break
  3580.           out of an infinite loop in assembler).  It might be
  3581.           a good idea to NOT have any other tasks running
  3582.           concurrently when programming in assembler.
  3583.  
  3584.  
  3585.  
  3586.  
  3587.  
  3588.  
  3589.  
  3590.  
  3591.  
  3592.  
  3593.  
  3594.  
  3595.  
  3596.  
  3597.  
  3598.  
  3599.  
  3600.  
  3601.           Reserved Symbols                                  56
  3602.  
  3603.           The following are guidelines for what not to use as
  3604.           symbols.  All of these symbols have special meaning
  3605.           to WASM:
  3606.  
  3607.           AX      AL      ES      BYTE
  3608.           CX      CL      CS      WORD
  3609.           DX      DL      SS      DWORD
  3610.           BX      BL      DS      QWORD
  3611.           SP      AH      NOT     TBYTE
  3612.           BP      CH      OFFSET  ANYSIZE
  3613.           SI      DH      NEAR    ST
  3614.           DI      BH      FAR     PROGRAM_SIZE
  3615.  
  3616.           All fields beginning with 0 to 9 are reserved for
  3617.           numbers.  The following characters should never be
  3618.           used in symbols: commas, spaces, any control
  3619.           characters, +, -, *, /, [, ], (, and ).  It is
  3620.           recommended that all symbols start with a letter and
  3621.           consist of only letters, numbers and underscores.
  3622.  
  3623.  
  3624.  
  3625.  
  3626.  
  3627.  
  3628.  
  3629.  
  3630.  
  3631.  
  3632.  
  3633.  
  3634.  
  3635.  
  3636.  
  3637.  
  3638.  
  3639.  
  3640.  
  3641.  
  3642.  
  3643.  
  3644.  
  3645.  
  3646.  
  3647.  
  3648.  
  3649.  
  3650.  
  3651.  
  3652.  
  3653.  
  3654.  
  3655.  
  3656.  
  3657.  
  3658.  
  3659.  
  3660.  
  3661.           Technical Notes                                   57
  3662.  
  3663.           The following are some theoretical upper limits to
  3664.           the source code:
  3665.  
  3666.           Symbol size .................. 255
  3667.           Line size .................... 255
  3668.           Total number of lines ........ 65535
  3669.           Total number of symbols ...... 65535
  3670.           Bytes of code ................ 65535
  3671.  
  3672.           None of these values are checked and unexpected
  3673.           results may occur if any of them are exceeded.  It
  3674.           is recommended that symbols and lines are kept to
  3675.           nice "reasonable" sizes, like no more than 100 or so
  3676.           characters.
  3677.  
  3678.           The symbol table is what really limits the size of
  3679.           the programs that can be assembled.  If a full
  3680.           segment of memory (64K) is available to WASM version
  3681.           1.0 (the most it can use), the symbol table has room
  3682.           for about 2080 ten byte symbols.
  3683.  
  3684.  
  3685.  
  3686.  
  3687.  
  3688.  
  3689.  
  3690.  
  3691.  
  3692.  
  3693.  
  3694.  
  3695.  
  3696.  
  3697.  
  3698.  
  3699.  
  3700.  
  3701.  
  3702.  
  3703.  
  3704.  
  3705.  
  3706.  
  3707.  
  3708.  
  3709.  
  3710.  
  3711.  
  3712.  
  3713.  
  3714.  
  3715.  
  3716.  
  3717.  
  3718.  
  3719.  
  3720.  
  3721.  
  3722.